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

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-12-20 17:43:46 +01:00 committed by Roland Haeder
parent f334f9e61f
commit 70a042fd04
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
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);
}
if (x($_GET,'pagename'))
if (x($_GET,'pagename')) {
$this->cmd = trim($_GET['pagename'],'/\\');
elseif (x($_GET,'q'))
} elseif (x($_GET,'q')) {
$this->cmd = trim($_GET['q'],'/\\');
}
// fix query_string
@ -694,13 +695,15 @@ class App {
// unix style "homedir"
if(substr($this->cmd,0,1) === '~')
if (substr($this->cmd,0,1) === '~') {
$this->cmd = 'profile/' . substr($this->cmd,1);
}
// 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);
}
/*

View file

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

View file

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

View file

@ -97,9 +97,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
if ($login_initial) {
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']);
}
}
}
@ -109,8 +110,9 @@ function can_write_wall(&$a,$owner) {
static $verified = 0;
if((! (local_user())) && (! (remote_user())))
if ((! (local_user())) && (! (remote_user()))) {
return false;
}
$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
// belongs to this page owner, and has the necessary permissions to post content
if($verified === 2)
if ($verified === 2) {
return true;
elseif($verified === 1)
} elseif ($verified === 1) {
return false;
else {
} else {
$cid = 0;
if (is_array($_SESSION['remote'])) {
@ -142,9 +144,9 @@ function can_write_wall(&$a,$owner) {
}
}
if(! $cid)
if (! $cid) {
return false;
}
$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

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));
}
if(isset($entry->network))
if (isset($entry->network)) {
$network = $entry->network;
}
if(isset($entry->currentLocation))
if (isset($entry->currentLocation)) {
$location = $entry->currentLocation;
}
if(isset($entry->aboutMe))
if (isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
}
if(isset($entry->gender))
if (isset($entry->gender)) {
$gender = $entry->gender;
}
if(isset($entry->generation) AND ($entry->generation > 0))
if (isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation;
}
if(isset($entry->tags))
foreach($entry->tags as $tag)
if (isset($entry->tags)) {
foreach($entry->tags as $tag) {
$keywords = implode(", ", $tag);
}
}
if (isset($entry->contactType) AND ($entry->contactType >= 0))
$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) {
$a = get_app();
// Generation:
// 0: No definition
// 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));
}
if(isset($entry->network))
if(isset($entry->network)) {
$network = $entry->network;
}
if(isset($entry->currentLocation))
if(isset($entry->currentLocation)) {
$location = $entry->currentLocation;
}
if(isset($entry->aboutMe))
if(isset($entry->aboutMe)) {
$about = html2bbcode($entry->aboutMe);
}
if(isset($entry->gender))
if(isset($entry->gender)) {
$gender = $entry->gender;
}
if(isset($entry->generation) AND ($entry->generation > 0))
if(isset($entry->generation) AND ($entry->generation > 0)) {
$generation = ++$entry->generation;
}
if(isset($entry->contactType) AND ($entry->contactType >= 0))
if(isset($entry->contactType) AND ($entry->contactType >= 0)) {
$contact_type = $entry->contactType;
}
if(isset($entry->tags))
foreach($entry->tags as $tag)
if(isset($entry->tags)) {
foreach ($entry->tags as $tag) {
$keywords = implode(", ", $tag);
}
}
if ($generation > 0) {
$success = true;

View file

@ -152,22 +152,26 @@ if((x($_GET,'zrl')) && (!$install && !$maintenance)) {
// 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");
}
if(! x($_SESSION,'authenticated'))
if (! x($_SESSION,'authenticated')) {
header('X-Account-Management-Status: none');
}
/* set up page['htmlhead'] and page['end'] for the modules to use */
$a->page['htmlhead'] = '';
$a->page['end'] = '';
if(! x($_SESSION,'sysmsg'))
if (! x($_SESSION,'sysmsg')) {
$_SESSION['sysmsg'] = array();
}
if(! x($_SESSION,'sysmsg_info'))
if (! x($_SESSION,'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array();
}
/*
* 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
// but we need "view" module for stylesheet
if($install && $a->module!="view")
if ($install && $a->module!="view") {
$a->module = 'install';
elseif($maintenance && $a->module!="view")
} elseif ($maintenance && $a->module!="view") {
$a->module = 'maintenance';
else {
} else {
check_url($a);
check_db();
check_plugins($a);
@ -191,8 +195,7 @@ nav_set_selected('nothing');
//Don't populate apps_menu if apps are private
$privateapps = get_config('config','private_addons');
if((local_user()) || (! $privateapps === "1"))
{
if ((local_user()) || (! $privateapps === "1")) {
$arr = array('app_menu' => $a->apps);
call_hooks('app_menu', $arr);
@ -304,11 +307,13 @@ if (file_exists($theme_info_file)){
/* initialise content region */
if(! x($a->page,'content'))
if (! x($a->page,'content')) {
$a->page['content'] = '';
}
if(!$install && !$maintenance)
if (!$install && !$maintenance) {
call_hooks('page_content_top',$a->page['content']);
}
/**
* Call module functions

View file

@ -1563,18 +1563,21 @@ function admin_page_plugins(App &$a){
$show_plugin = true;
// 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;
}
// 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;
}
if($show_plugin)
if ($show_plugin) {
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
}
}
}
}
$t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array(

View file

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

View file

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

View file

@ -125,10 +125,12 @@ function dfrn_request_post(App &$a) {
return;
}
else {
if(! x($parms,'fn'))
if (! x($parms,'fn')) {
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 );
}
$invalid = Probe::valid_dfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
@ -524,10 +526,12 @@ function dfrn_request_post(App &$a) {
goaway(App::get_baseurl() . '/' . $a->cmd);
}
else {
if(! x($parms,'fn'))
if (! x($parms,'fn')) {
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 );
}
$invalid = Probe::valid_dfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
@ -817,8 +821,11 @@ function dfrn_request_content(App &$a) {
else {
$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();
}
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
@ -831,10 +838,12 @@ function dfrn_request_content(App &$a) {
*
*/
if($a->profile['page-flags'] == PAGE_NORMAL)
if ($a->profile['page-flags'] == PAGE_NORMAL) {
$tpl = get_markup_template('dfrn_request.tpl');
else
}
else {
$tpl = get_markup_template('auto_request.tpl');
}
$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(App &$a) {
return;
}
if(! x($a->page,'aside'))
if (! x($a->page,'aside')) {
$a->page['aside'] = '';
}
$a->page['aside'] .= findpeople_widget();
@ -85,15 +86,19 @@ function dirfind_content(&$a, $prefix = "") {
$perpage = 80;
$startrec = (($a->pager['page']) * $perpage) - $perpage;
if (get_config('system','diaspora_enabled'))
if (get_config('system','diaspora_enabled')) {
$diaspora = NETWORK_DIASPORA;
else
}
else {
$diaspora = NETWORK_DFRN;
}
if (!get_config('system','ostatus_disabled'))
if (!get_config('system','ostatus_disabled')) {
$ostatus = NETWORK_OSTATUS;
else
}
else {
$ostatus = NETWORK_DFRN;
}
$search2 = "%".$search."%";
@ -133,8 +138,9 @@ function dirfind_content(&$a, $prefix = "") {
$j->items_page = $perpage;
$j->page = $a->pager['page'];
foreach ($results AS $result) {
if (poco_alternate_ostatus_url($result["url"]))
if (poco_alternate_ostatus_url($result["url"])) {
continue;
}
$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]);
$details = _contact_detail_for_template($contact[0]);
$alt_text = $details['alt_text'];
} else
}
else {
$photo_menu = array();
}
} else {
$connlnk = App::get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
$conntxt = t('Connect');

View file

@ -275,18 +275,22 @@ function events_content(App &$a) {
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y)
if (! $y) {
$y = intval($thisyear);
if(! $m)
}
if (! $m) {
$m = intval($thismonth);
}
// 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.
if($y < 1901)
if ($y < 1901) {
$y = 1900;
if($y > 2099)
}
if ($y > 2099) {
$y = 2100;
}
$nextyear = $y;
$nextmonth = $m + 1;

View file

@ -1175,8 +1175,9 @@ function settings_content(App &$a) {
'$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 = '';
}
$hide_friends = replace_macros($opt_tpl,array(