1
1
Fork 0

more spaces + some curly spaces added

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-26 16:07:30 +01:00 committed by Roland Haeder
parent 41a36606c6
commit 951006dd10
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
42 changed files with 206 additions and 187 deletions

View file

@ -1172,11 +1172,13 @@ class Probe {
$personal = imap_mime_header_decode($feadr->personal);
$data["name"] = "";
foreach($personal as $perspart)
if ($perspart->charset != "default")
foreach ($personal as $perspart) {
if ($perspart->charset != "default") {
$data["name"] .= iconv($perspart->charset, 'UTF-8//IGNORE', $perspart->text);
else
} else {
$data["name"] .= $perspart->text;
}
}
$data["name"] = notags($data["name"]);
}

View file

@ -121,8 +121,9 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude']));
if (is_array($x['networks']) && count($x['networks'])) {
for($y = 0; $y < count($x['networks']) ; $y ++)
for ($y = 0; $y < count($x['networks']) ; $y ++) {
$x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'";
}
$str_nets = implode(',',$x['networks']);
$sql_extra .= " AND `network` IN ( $str_nets ) ";
}

View file

@ -219,17 +219,20 @@ function bb_find_open_close($s, $open, $close, $occurance = 1) {
$start_pos = -1;
for ($i = 1; $i <= $occurance; $i++) {
if ( $start_pos !== false)
if ( $start_pos !== false) {
$start_pos = strpos($s, $open, $start_pos + 1);
}
}
if ( $start_pos === false)
if ( $start_pos === false) {
return false;
}
$end_pos = strpos($s, $close, $start_pos);
if ( $end_pos === false)
if ( $end_pos === false) {
return false;
}
$res = array( 'start' => $start_pos, 'end' => $end_pos );
@ -243,9 +246,10 @@ function get_bb_tag_pos($s, $name, $occurance = 1) {
$start_open = -1;
for ($i = 1; $i <= $occurance; $i++) {
if ( $start_open !== false)
if ( $start_open !== false) {
$start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags
}
}
if ( $start_open === false)
return false;

View file

@ -484,9 +484,10 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$str_blocked = get_pconfig(local_user(),'system','blocked');
if ($str_blocked) {
$arr_blocked = explode(',',$str_blocked);
for($x = 0; $x < count($arr_blocked); $x ++)
for ($x = 0; $x < count($arr_blocked); $x ++) {
$arr_blocked[$x] = trim($arr_blocked[$x]);
}
}
}
@ -1454,9 +1455,10 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$count = 0;
foreach ($ret as $key) {
if ($key['count'] == true)
if ($key['count'] == true) {
$count++;
}
}
$ret['count'] = $count;
return $ret;

View file

@ -48,12 +48,12 @@ function select_timezone($current = 'America/Los_Angeles') {
$continent = $ex[0];
$o .= '<optgroup label="' . t($continent) . '">';
}
if (count($ex) > 2)
if (count($ex) > 2) {
$city = substr($value,strpos($value,'/')+1);
else
} else {
$city = $ex[1];
}
else {
} else {
$city = $ex[0];
if ($continent != t('Miscellaneous')) {
$o .= '</optgroup>';

View file

@ -230,11 +230,13 @@ function gs_search_user($search) {
if (!$result["success"]) {
return false;
}
$contacts = json_decode($result["body"]);
if ($contacts->status == 'ERROR') {
return false;
}
foreach ($contacts->data AS $user) {
$contact = probe_url($user->site_address."/".$user->name);
if ($contact["network"] != NETWORK_PHANTOM) {

View file

@ -347,9 +347,10 @@ function groups_containing($uid,$c) {
$ret = array();
if (dbm::is_result($r)) {
foreach($r as $rr)
foreach ($r as $rr) {
$ret[] = $rr['gid'];
}
}
return $ret;
}

View file

@ -497,14 +497,15 @@ function allowed_url($url) {
*/
function allowed_email($email) {
$domain = strtolower(substr($email,strpos($email,'@') + 1));
if (! $domain)
if (! $domain) {
return false;
}
$str_allowed = get_config('system','allowed_email');
if (! $str_allowed)
if (! $str_allowed) {
return true;
}
$found = false;

View file

@ -437,17 +437,19 @@ function onepoll_run(&$argv, &$argc){
if ($raw_refs) {
$refs_arr = explode(' ', $raw_refs);
if (count($refs_arr)) {
for($x = 0; $x < count($refs_arr); $x ++)
for ($x = 0; $x < count($refs_arr); $x ++) {
$refs_arr[$x] = "'" . msgid2iri(str_replace(array('<','>',' '),array('','',''),dbesc($refs_arr[$x]))) . "'";
}
}
$qstr = implode(',',$refs_arr);
$r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
intval($importer_uid)
);
if (dbm::is_result($r))
if (dbm::is_result($r)) {
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
//$datarray['parent-uri'] = $r[0]['uri'];
}
}
// Decoding the header
$subject = imap_mime_header_decode($meta->subject);

View file

@ -365,10 +365,10 @@ function poller_kill_stale_workers() {
}
foreach ($r AS $pid)
if (!posix_kill($pid["pid"], 0))
if (!posix_kill($pid["pid"], 0)) {
q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",
intval($pid["pid"]));
else {
} else {
// Kill long running processes
// Check if the priority is in a valid range
@ -396,10 +396,11 @@ function poller_kill_stale_workers() {
dbesc(datetime_convert()),
intval(PRIORITY_NEGLIGIBLE),
intval($pid["pid"]));
} else
} else {
logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
}
}
}
/**
* @brief Checks if the number of active workers exceeds the given limits

View file

@ -16,8 +16,7 @@ function get_salmon_key($uri,$keyhash) {
$ret[] = $a['@attributes']['href'];
}
}
}
else {
} else {
return '';
}

View file

@ -1647,20 +1647,22 @@ function poco_discover_federation() {
}
}
// Currently disabled, since the service isn't available anymore.
// It is not removed since I hope that there will be a successor.
// Discover GNU Social Servers.
//if (!get_config('system','ostatus_disabled')) {
// $serverdata = "http://gstools.org/api/get_open_instances/";
/*
* Currently disabled, since the service isn't available anymore.
* It is not removed since I hope that there will be a successor.
* Discover GNU Social Servers.
if (!get_config('system','ostatus_disabled')) {
$serverdata = "http://gstools.org/api/get_open_instances/";
// $result = z_fetch_url($serverdata);
// if ($result["success"]) {
// $servers = json_decode($result["body"]);
$result = z_fetch_url($serverdata);
if ($result["success"]) {
$servers = json_decode($result["body"]);
// foreach($servers->data AS $server)
// poco_check_server($server->instance_address);
// }
//}
foreach($servers->data AS $server)
poco_check_server($server->instance_address);
}
}
*/
set_config('poco','last_federation_discovery', time());
}

View file

@ -109,14 +109,16 @@ class Template implements ITemplateEngine {
//$vals = $this->r[$m[0]];
$vals = $this->_get_var($m[0]);
$ret = "";
if (!is_array($vals))
if (!is_array($vals)) {
return $ret;
}
foreach ($vals as $k => $v) {
$this->_push_stack();
$r = $this->r;
$r[$varname] = $v;
if ($keyname != '')
if ($keyname != '') {
$r[$keyname] = (($k === 0) ? '0' : $k);
}
$ret .= $this->replace($args[3], $r);
$this->_pop_stack();
}