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); $personal = imap_mime_header_decode($feadr->personal);
$data["name"] = ""; $data["name"] = "";
foreach($personal as $perspart) foreach ($personal as $perspart) {
if ($perspart->charset != "default") if ($perspart->charset != "default") {
$data["name"] .= iconv($perspart->charset, 'UTF-8//IGNORE', $perspart->text); $data["name"] .= iconv($perspart->charset, 'UTF-8//IGNORE', $perspart->text);
else } else {
$data["name"] .= $perspart->text; $data["name"] .= $perspart->text;
}
}
$data["name"] = notags($data["name"]); $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'])); $sql_extra .= sprintf(" AND `id` != %d ", intval($x['exclude']));
if (is_array($x['networks']) && count($x['networks'])) { 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]) . "'"; $x['networks'][$y] = "'" . dbesc($x['networks'][$y]) . "'";
}
$str_nets = implode(',',$x['networks']); $str_nets = implode(',',$x['networks']);
$sql_extra .= " AND `network` IN ( $str_nets ) "; $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; $start_pos = -1;
for ($i = 1; $i <= $occurance; $i++) { for ($i = 1; $i <= $occurance; $i++) {
if ( $start_pos !== false) if ( $start_pos !== false) {
$start_pos = strpos($s, $open, $start_pos + 1); $start_pos = strpos($s, $open, $start_pos + 1);
} }
}
if ( $start_pos === false) if ( $start_pos === false) {
return false; return false;
}
$end_pos = strpos($s, $close, $start_pos); $end_pos = strpos($s, $close, $start_pos);
if ( $end_pos === false) if ( $end_pos === false) {
return false; return false;
}
$res = array( 'start' => $start_pos, 'end' => $end_pos ); $res = array( 'start' => $start_pos, 'end' => $end_pos );
@ -243,9 +246,10 @@ function get_bb_tag_pos($s, $name, $occurance = 1) {
$start_open = -1; $start_open = -1;
for ($i = 1; $i <= $occurance; $i++) { 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 $start_open = strpos($s, '[' . $name, $start_open + 1); // allow [name= type tags
} }
}
if ( $start_open === false) if ( $start_open === false)
return 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'); $str_blocked = get_pconfig(local_user(),'system','blocked');
if ($str_blocked) { if ($str_blocked) {
$arr_blocked = explode(',',$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]); $arr_blocked[$x] = trim($arr_blocked[$x]);
} }
}
} }
@ -1454,9 +1455,10 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) {
$count = 0; $count = 0;
foreach ($ret as $key) { foreach ($ret as $key) {
if ($key['count'] == true) if ($key['count'] == true) {
$count++; $count++;
} }
}
$ret['count'] = $count; $ret['count'] = $count;
return $ret; return $ret;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -365,10 +365,10 @@ function poller_kill_stale_workers() {
} }
foreach ($r AS $pid) 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", q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",
intval($pid["pid"])); intval($pid["pid"]));
else { } else {
// Kill long running processes // Kill long running processes
// Check if the priority is in a valid range // Check if the priority is in a valid range
@ -396,10 +396,11 @@ function poller_kill_stale_workers() {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval(PRIORITY_NEGLIGIBLE), intval(PRIORITY_NEGLIGIBLE),
intval($pid["pid"])); 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); 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 * @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']; $ret[] = $a['@attributes']['href'];
} }
} }
} } else {
else {
return ''; 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. * Currently disabled, since the service isn't available anymore.
// Discover GNU Social Servers. * It is not removed since I hope that there will be a successor.
//if (!get_config('system','ostatus_disabled')) { * Discover GNU Social Servers.
// $serverdata = "http://gstools.org/api/get_open_instances/"; if (!get_config('system','ostatus_disabled')) {
$serverdata = "http://gstools.org/api/get_open_instances/";
// $result = z_fetch_url($serverdata); $result = z_fetch_url($serverdata);
// if ($result["success"]) { if ($result["success"]) {
// $servers = json_decode($result["body"]); $servers = json_decode($result["body"]);
// foreach($servers->data AS $server) foreach($servers->data AS $server)
// poco_check_server($server->instance_address); poco_check_server($server->instance_address);
// } }
//} }
*/
set_config('poco','last_federation_discovery', time()); set_config('poco','last_federation_discovery', time());
} }

View file

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