added more curly braces + space between "if" and brace

Signed-off-by: Roland Häder <roland@mxchange.org>

Conflicts:
	mod/admin.php
This commit is contained in:
Roland Häder 2016-12-20 17:43:46 +01:00
parent 4805aa8fdb
commit de689583e2
15 changed files with 225 additions and 167 deletions

View file

@ -682,10 +682,11 @@ class App {
$this->query_string = substr($this->query_string, 1); $this->query_string = substr($this->query_string, 1);
} }
if (x($_GET,'pagename')) if (x($_GET,'pagename')) {
$this->cmd = trim($_GET['pagename'],'/\\'); $this->cmd = trim($_GET['pagename'],'/\\');
elseif (x($_GET,'q')) } elseif (x($_GET,'q')) {
$this->cmd = trim($_GET['q'],'/\\'); $this->cmd = trim($_GET['q'],'/\\');
}
// fix query_string // fix query_string
@ -694,13 +695,15 @@ class App {
// unix style "homedir" // unix style "homedir"
if(substr($this->cmd,0,1) === '~') if (substr($this->cmd,0,1) === '~') {
$this->cmd = 'profile/' . substr($this->cmd,1); $this->cmd = 'profile/' . substr($this->cmd,1);
}
// Diaspora style profile url // Diaspora style profile url
if(substr($this->cmd,0,2) === 'u/') if (substr($this->cmd,0,2) === 'u/') {
$this->cmd = 'profile/' . substr($this->cmd,2); $this->cmd = 'profile/' . substr($this->cmd,2);
}
/* /*

View file

@ -91,17 +91,21 @@ function new_contact($uid,$url,$interactive = false) {
call_hooks('follow', $arr); call_hooks('follow', $arr);
if(x($arr['contact'],'name')) if (x($arr['contact'],'name')) {
$ret = $arr['contact']; $ret = $arr['contact'];
else }
else {
$ret = probe_url($url); $ret = probe_url($url);
}
if ($ret['network'] === NETWORK_DFRN) { if ($ret['network'] === NETWORK_DFRN) {
if ($interactive) { if ($interactive) {
if(strlen($a->path)) if (strlen($a->path)) {
$myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']); $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
else }
else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname()); $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
}
goaway($ret['request'] . "&addr=$myaddr"); goaway($ret['request'] . "&addr=$myaddr");

View file

@ -27,14 +27,16 @@ function get_salmon_key($uri,$keyhash) {
if (count($ret) > 0) { if (count($ret) > 0) {
for ($x = 0; $x < count($ret); $x ++) { for ($x = 0; $x < count($ret); $x ++) {
if (substr($ret[$x],0,5) === 'data:') { if (substr($ret[$x],0,5) === 'data:') {
if(strstr($ret[$x],',')) if (strstr($ret[$x],',')) {
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1); $ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
else } else {
$ret[$x] = substr($ret[$x],5); $ret[$x] = substr($ret[$x],5);
} elseif (normalise_link($ret[$x]) == 'http://') }
} elseif (normalise_link($ret[$x]) == 'http://') {
$ret[$x] = fetch_url($ret[$x]); $ret[$x] = fetch_url($ret[$x]);
} }
} }
}
logger('Key located: ' . print_r($ret,true)); logger('Key located: ' . print_r($ret,true));
@ -52,10 +54,11 @@ function get_salmon_key($uri,$keyhash) {
else { else {
foreach ($ret as $a) { foreach ($ret as $a) {
$hash = base64url_encode(hash('sha256',$a)); $hash = base64url_encode(hash('sha256',$a));
if($hash == $keyhash) if ($hash == $keyhash) {
return $a; return $a;
} }
} }
}
return ''; return '';
} }

View file

@ -97,9 +97,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
if ($login_initial) { if ($login_initial) {
call_hooks('logged_in', $a->user); call_hooks('logged_in', $a->user);
if(($a->module !== 'home') && isset($_SESSION['return_url'])) if (($a->module !== 'home') && isset($_SESSION['return_url'])) {
goaway(App::get_baseurl() . '/' . $_SESSION['return_url']); goaway(App::get_baseurl() . '/' . $_SESSION['return_url']);
} }
}
} }
@ -109,8 +110,9 @@ function can_write_wall(&$a,$owner) {
static $verified = 0; static $verified = 0;
if((! (local_user())) && (! (remote_user()))) if ((! (local_user())) && (! (remote_user()))) {
return false; return false;
}
$uid = local_user(); $uid = local_user();
@ -126,11 +128,11 @@ function can_write_wall(&$a,$owner) {
// We have a contact-id for an authenticated remote user, this block determines if the contact // We have a contact-id for an authenticated remote user, this block determines if the contact
// belongs to this page owner, and has the necessary permissions to post content // belongs to this page owner, and has the necessary permissions to post content
if($verified === 2) if ($verified === 2) {
return true; return true;
elseif($verified === 1) } elseif ($verified === 1) {
return false; return false;
else { } else {
$cid = 0; $cid = 0;
if (is_array($_SESSION['remote'])) { if (is_array($_SESSION['remote'])) {
@ -142,9 +144,9 @@ function can_write_wall(&$a,$owner) {
} }
} }
if(! $cid) if (! $cid) {
return false; return false;
}
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid` $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0

View file

@ -112,27 +112,35 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
} }
} }
if(isset($entry->updated)) if (isset($entry->updated)) {
$updated = date("Y-m-d H:i:s", strtotime($entry->updated)); $updated = date("Y-m-d H:i:s", strtotime($entry->updated));
}
if(isset($entry->network)) if (isset($entry->network)) {
$network = $entry->network; $network = $entry->network;
}
if(isset($entry->currentLocation)) if (isset($entry->currentLocation)) {
$location = $entry->currentLocation; $location = $entry->currentLocation;
}
if(isset($entry->aboutMe)) if (isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe); $about = html2bbcode($entry->aboutMe);
}
if(isset($entry->gender)) if (isset($entry->gender)) {
$gender = $entry->gender; $gender = $entry->gender;
}
if(isset($entry->generation) AND ($entry->generation > 0)) if (isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation; $generation = ++$entry->generation;
}
if(isset($entry->tags)) if (isset($entry->tags)) {
foreach($entry->tags as $tag) foreach($entry->tags as $tag) {
$keywords = implode(", ", $tag); $keywords = implode(", ", $tag);
}
}
if (isset($entry->contactType) AND ($entry->contactType >= 0)) if (isset($entry->contactType) AND ($entry->contactType >= 0))
$contact_type = $entry->contactType; $contact_type = $entry->contactType;
@ -171,8 +179,6 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid = 0, $uid = 0, $zcid = 0) { function poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid = 0, $uid = 0, $zcid = 0) {
$a = get_app();
// Generation: // Generation:
// 0: No definition // 0: No definition
// 1: Profiles on this server // 1: Profiles on this server
@ -1399,30 +1405,39 @@ function poco_discover_server($data, $default_generation = 0) {
} }
} }
if(isset($entry->updated)) if (isset($entry->updated)) {
$updated = date("Y-m-d H:i:s", strtotime($entry->updated)); $updated = date("Y-m-d H:i:s", strtotime($entry->updated));
}
if(isset($entry->network)) if(isset($entry->network)) {
$network = $entry->network; $network = $entry->network;
}
if(isset($entry->currentLocation)) if(isset($entry->currentLocation)) {
$location = $entry->currentLocation; $location = $entry->currentLocation;
}
if(isset($entry->aboutMe)) if(isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe); $about = html2bbcode($entry->aboutMe);
}
if(isset($entry->gender)) if(isset($entry->gender)) {
$gender = $entry->gender; $gender = $entry->gender;
}
if(isset($entry->generation) AND ($entry->generation > 0)) if(isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation; $generation = ++$entry->generation;
}
if(isset($entry->contactType) AND ($entry->contactType >= 0)) if(isset($entry->contactType) AND ($entry->contactType >= 0)) {
$contact_type = $entry->contactType; $contact_type = $entry->contactType;
}
if(isset($entry->tags)) if(isset($entry->tags)) {
foreach($entry->tags as $tag) foreach ($entry->tags as $tag) {
$keywords = implode(", ", $tag); $keywords = implode(", ", $tag);
}
}
if ($generation > 0) { if ($generation > 0) {
$success = true; $success = true;

View file

@ -152,22 +152,26 @@ if((x($_GET,'zrl')) && (!$install && !$maintenance)) {
// header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";'); // header('Link: <' . App::get_baseurl() . '/amcd>; rel="acct-mgmt";');
if(x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) if (x($_COOKIE["Friendica"]) || (x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module === 'login')) {
require("include/auth.php"); require("include/auth.php");
}
if(! x($_SESSION,'authenticated')) if (! x($_SESSION,'authenticated')) {
header('X-Account-Management-Status: none'); header('X-Account-Management-Status: none');
}
/* set up page['htmlhead'] and page['end'] for the modules to use */ /* set up page['htmlhead'] and page['end'] for the modules to use */
$a->page['htmlhead'] = ''; $a->page['htmlhead'] = '';
$a->page['end'] = ''; $a->page['end'] = '';
if(! x($_SESSION,'sysmsg')) if (! x($_SESSION,'sysmsg')) {
$_SESSION['sysmsg'] = array(); $_SESSION['sysmsg'] = array();
}
if(! x($_SESSION,'sysmsg_info')) if (! x($_SESSION,'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array(); $_SESSION['sysmsg_info'] = array();
}
/* /*
* check_config() is responsible for running update scripts. These automatically * check_config() is responsible for running update scripts. These automatically
@ -177,11 +181,11 @@ if(! x($_SESSION,'sysmsg_info'))
// in install mode, any url loads install module // in install mode, any url loads install module
// but we need "view" module for stylesheet // but we need "view" module for stylesheet
if($install && $a->module!="view") if ($install && $a->module!="view") {
$a->module = 'install'; $a->module = 'install';
elseif($maintenance && $a->module!="view") } elseif ($maintenance && $a->module!="view") {
$a->module = 'maintenance'; $a->module = 'maintenance';
else { } else {
check_url($a); check_url($a);
check_db(); check_db();
check_plugins($a); check_plugins($a);
@ -191,8 +195,7 @@ nav_set_selected('nothing');
//Don't populate apps_menu if apps are private //Don't populate apps_menu if apps are private
$privateapps = get_config('config','private_addons'); $privateapps = get_config('config','private_addons');
if((local_user()) || (! $privateapps === "1")) if ((local_user()) || (! $privateapps === "1")) {
{
$arr = array('app_menu' => $a->apps); $arr = array('app_menu' => $a->apps);
call_hooks('app_menu', $arr); call_hooks('app_menu', $arr);
@ -304,11 +307,13 @@ if (file_exists($theme_info_file)){
/* initialise content region */ /* initialise content region */
if(! x($a->page,'content')) if (! x($a->page,'content')) {
$a->page['content'] = ''; $a->page['content'] = '';
}
if(!$install && !$maintenance) if (!$install && !$maintenance) {
call_hooks('page_content_top',$a->page['content']); call_hooks('page_content_top',$a->page['content']);
}
/** /**
* Call module functions * Call module functions

View file

@ -1563,18 +1563,21 @@ function admin_page_plugins(&$a){
$show_plugin = true; $show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled // If the addon is unsupported, then only show it, when it is enabled
if((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) {
$show_plugin = false; $show_plugin = false;
}
// Override the above szenario, when the admin really wants to see outdated stuff // Override the above szenario, when the admin really wants to see outdated stuff
if(get_config("system", "show_unsupported_addons")) if (get_config("system", "show_unsupported_addons")) {
$show_plugin = true; $show_plugin = true;
}
if($show_plugin) if ($show_plugin) {
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info); $plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
} }
} }
} }
}
$t = get_markup_template("admin_plugins.tpl"); $t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array( return replace_macros($t, array(

View file

@ -29,8 +29,8 @@ function allfriends_content(&$a) {
); );
if (! count($c)) { if (! count($c)) {
}
return; return;
}
$a->page['aside'] = ""; $a->page['aside'] = "";
profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"])); profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));

View file

@ -503,10 +503,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
// Let's send our user to the contact editor in case they want to // Let's send our user to the contact editor in case they want to
// do anything special with this new friend. // do anything special with this new friend.
if($handsfree === null) if ($handsfree === null) {
goaway(App::get_baseurl() . '/contacts/' . intval($contact_id)); goaway(App::get_baseurl() . '/contacts/' . intval($contact_id));
else } else {
return; return;
}
//NOTREACHED //NOTREACHED
} }

View file

@ -125,10 +125,12 @@ function dfrn_request_post(&$a) {
return; return;
} }
else { else {
if(! x($parms,'fn')) if (! x($parms,'fn')) {
notice( t('Warning: profile location has no identifiable owner name.') . EOL ); notice( t('Warning: profile location has no identifiable owner name.') . EOL );
if(! x($parms,'photo')) }
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL ); notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms); $invalid = Probe::valid_dfrn($parms);
if ($invalid) { if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location", notice( sprintf( tt("%d required parameter was not found at the given location",
@ -524,10 +526,12 @@ function dfrn_request_post(&$a) {
goaway(App::get_baseurl() . '/' . $a->cmd); goaway(App::get_baseurl() . '/' . $a->cmd);
} }
else { else {
if(! x($parms,'fn')) if (! x($parms,'fn')) {
notice( t('Warning: profile location has no identifiable owner name.') . EOL ); notice( t('Warning: profile location has no identifiable owner name.') . EOL );
if(! x($parms,'photo')) }
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL ); notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms); $invalid = Probe::valid_dfrn($parms);
if ($invalid) { if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location", notice( sprintf( tt("%d required parameter was not found at the given location",
@ -817,8 +821,11 @@ function dfrn_request_content(&$a) {
else { else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
} }
} else // last, try a zrl }
else {
// last, try a zrl
$myaddr = get_my_url(); $myaddr = get_my_url();
}
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); $target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
@ -831,10 +838,12 @@ function dfrn_request_content(&$a) {
* *
*/ */
if($a->profile['page-flags'] == PAGE_NORMAL) if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl'); $tpl = get_markup_template('dfrn_request.tpl');
else }
else {
$tpl = get_markup_template('auto_request.tpl'); $tpl = get_markup_template('auto_request.tpl');
}
$page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:"); $page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");

View file

@ -12,8 +12,9 @@ function dirfind_init(&$a) {
return; return;
} }
if(! x($a->page,'aside')) if (! x($a->page,'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= findpeople_widget();
@ -85,15 +86,19 @@ function dirfind_content(&$a, $prefix = "") {
$perpage = 80; $perpage = 80;
$startrec = (($a->pager['page']) * $perpage) - $perpage; $startrec = (($a->pager['page']) * $perpage) - $perpage;
if (get_config('system','diaspora_enabled')) if (get_config('system','diaspora_enabled')) {
$diaspora = NETWORK_DIASPORA; $diaspora = NETWORK_DIASPORA;
else }
else {
$diaspora = NETWORK_DFRN; $diaspora = NETWORK_DFRN;
}
if (!get_config('system','ostatus_disabled')) if (!get_config('system','ostatus_disabled')) {
$ostatus = NETWORK_OSTATUS; $ostatus = NETWORK_OSTATUS;
else }
else {
$ostatus = NETWORK_DFRN; $ostatus = NETWORK_DFRN;
}
$search2 = "%".$search."%"; $search2 = "%".$search."%";
@ -133,8 +138,9 @@ function dirfind_content(&$a, $prefix = "") {
$j->items_page = $perpage; $j->items_page = $perpage;
$j->page = $a->pager['page']; $j->page = $a->pager['page'];
foreach ($results AS $result) { foreach ($results AS $result) {
if (poco_alternate_ostatus_url($result["url"])) if (poco_alternate_ostatus_url($result["url"])) {
continue; continue;
}
$result = get_contact_details_by_url($result["url"], local_user(), $result); $result = get_contact_details_by_url($result["url"], local_user(), $result);
@ -194,8 +200,10 @@ function dirfind_content(&$a, $prefix = "") {
$photo_menu = contact_photo_menu($contact[0]); $photo_menu = contact_photo_menu($contact[0]);
$details = _contact_detail_for_template($contact[0]); $details = _contact_detail_for_template($contact[0]);
$alt_text = $details['alt_text']; $alt_text = $details['alt_text'];
} else }
else {
$photo_menu = array(); $photo_menu = array();
}
} else { } else {
$connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
$conntxt = t('Connect'); $conntxt = t('Connect');

View file

@ -274,18 +274,22 @@ function events_content(&$a) {
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y) if (! $y) {
$y = intval($thisyear); $y = intval($thisyear);
if(! $m) }
if (! $m) {
$m = intval($thismonth); $m = intval($thismonth);
}
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900. // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future. // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
if($y < 1901) if ($y < 1901) {
$y = 1900; $y = 1900;
if($y > 2099) }
if ($y > 2099) {
$y = 2100; $y = 2100;
}
$nextyear = $y; $nextyear = $y;
$nextmonth = $m + 1; $nextmonth = $m + 1;

View file

@ -1175,8 +1175,9 @@ function settings_content(&$a) {
'$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))), '$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'),t('Yes'))),
)); ));
} }
else else {
$profile_in_net_dir = ''; $profile_in_net_dir = '';
}
$hide_friends = replace_macros($opt_tpl,array( $hide_friends = replace_macros($opt_tpl,array(