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
commit de689583e2
15 changed files with 225 additions and 167 deletions

View file

@ -1129,19 +1129,19 @@ function admin_page_dbsync(&$a) {
$failed[] = $upd;
}
}
if(! count($failed)) {
if (! count($failed)) {
$o = replace_macros(get_markup_template('structure_check.tpl'),array(
'$base' => App::get_baseurl(true),
'$base' => App::get_baseurl(true),
'$banner' => t('No failed updates.'),
'$check' => t('Check database structure'),
'$check' => t('Check database structure'),
));
} else {
$o = replace_macros(get_markup_template('failed_updates.tpl'),array(
'$base' => App::get_baseurl(true),
'$base' => App::get_baseurl(true),
'$banner' => t('Failed Updates'),
'$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
'$mark' => t('Mark success (if update was manually applied)'),
'$apply' => t('Attempt to execute this update step automatically'),
'$desc' => t('This does not include updates prior to 1139, which did not return a status.'),
'$mark' => t('Mark success (if update was manually applied)'),
'$apply' => t('Attempt to execute this update step automatically'),
'$failed' => $failed
));
}
@ -1156,11 +1156,11 @@ function admin_page_dbsync(&$a) {
* @param App $a
*/
function admin_page_users_post(&$a){
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
$nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
$nu_email = (x($_POST, 'new_user_email') ? $_POST['new_user_email'] : '');
$nu_language = get_config('system', 'language');
check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
@ -1546,7 +1546,7 @@ function admin_page_plugins(&$a){
* List plugins
*/
if(x($_GET,"a") && $_GET['a']=="r") {
if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/plugins', 'admin_themes', 't');
reload_plugins();
info("Plugins reloaded");
@ -1555,23 +1555,26 @@ function admin_page_plugins(&$a){
$plugins = array();
$files = glob("addon/*/");
if($files) {
foreach($files as $file) {
if(is_dir($file)) {
if ($files) {
foreach ($files as $file) {
if (is_dir($file)) {
list($tmp, $id)=array_map("trim", explode("/",$file));
$info = get_plugin_info($id);
$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);
}
}
}
}
@ -1798,11 +1801,11 @@ function admin_page_themes(&$a){
// reload active themes
if(x($_GET,"a") && $_GET['a']=="r") {
if (x($_GET,"a") && $_GET['a']=="r") {
check_form_security_token_redirectOnErr(App::get_baseurl().'/admin/themes', 'admin_themes', 't');
if($themes) {
foreach($themes as $th) {
if($th['allowed']) {
if ($themes) {
foreach ($themes as $th) {
if ($th['allowed']) {
uninstall_theme($th['name']);
install_theme($th['name']);
}
@ -1817,7 +1820,7 @@ function admin_page_themes(&$a){
*/
$xthemes = array();
if($themes) {
if ($themes) {
foreach($themes as $th) {
$xthemes[] = array($th['name'],(($th['allowed']) ? "on" : "off"), get_theme_info($th['name']));
}
@ -1826,17 +1829,17 @@ function admin_page_themes(&$a){
$t = get_markup_template("admin_plugins.tpl");
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Themes'),
'$submit' => t('Save Settings'),
'$reload' => t('Reload active themes'),
'$baseurl' => App::get_baseurl(true),
'$function' => 'themes',
'$plugins' => $xthemes,
'$pcount' => count($themes),
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
'$experimental' => t('[Experimental]'),
'$unsupported' => t('[Unsupported]'),
'$title' => t('Administration'),
'$page' => t('Themes'),
'$submit' => t('Save Settings'),
'$reload' => t('Reload active themes'),
'$baseurl' => App::get_baseurl(true),
'$function' => 'themes',
'$plugins' => $xthemes,
'$pcount' => count($themes),
'$noplugshint' => sprintf(t('No themes found on the system. They should be paced in %1$s'),'<code>/view/themes</code>'),
'$experimental' => t('[Experimental]'),
'$unsupported' => t('[Unsupported]'),
'$form_security_token' => get_form_security_token("admin_themes"),
));
}

View file

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

View file

@ -231,7 +231,7 @@ function cal_content(&$a) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
if(! x($links,$j)) {
if (! x($links,$j)) {
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}

View file

@ -13,7 +13,7 @@ function delegate_content(&$a) {
return;
}
if($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions
@ -42,7 +42,7 @@ function delegate_content(&$a) {
goaway(App::get_baseurl() . '/delegate');
}
if($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
// delegated admins can view but not change delegation permissions

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
// 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
}
@ -522,7 +523,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
*
*/
if(x($_POST,'source_url')) {
if (x($_POST,'source_url')) {
// We are processing an external confirmation to an introduction created by our user.
@ -543,7 +544,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
// If $aes_key is set, both of these items require unpacking from the hex transport encoding.
if(x($aes_key)) {
if (x($aes_key)) {
$aes_key = hex2bin($aes_key);
$public_key = hex2bin($public_key);
}

View file

@ -120,17 +120,19 @@ function dfrn_request_post(&$a) {
$parms = Probe::profile($dfrn_url);
if(! count($parms)) {
if (! count($parms)) {
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
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) {
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$invalid), $invalid) . EOL );
@ -502,13 +504,13 @@ function dfrn_request_post(&$a) {
);
}
else {
if(! validate_url($url)) {
if (! validate_url($url)) {
notice( t('Invalid profile URL.') . EOL);
goaway(App::get_baseurl() . '/' . $a->cmd);
return; // NOTREACHED
}
if(! allowed_url($url)) {
if (! allowed_url($url)) {
notice( t('Disallowed profile URL.') . EOL);
goaway(App::get_baseurl() . '/' . $a->cmd);
return; // NOTREACHED
@ -519,17 +521,19 @@ function dfrn_request_post(&$a) {
$parms = Probe::profile(($hcard) ? $hcard : $url);
if(! count($parms)) {
if (! count($parms)) {
notice( t('Profile location is not valid or does not contain profile information.') . EOL );
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) {
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
$invalid), $invalid) . EOL );
@ -810,15 +814,18 @@ function dfrn_request_content(&$a) {
$myaddr = hex2bin($_GET['addr']);
elseif (x($_GET,'address') AND ($_GET['address'] != ""))
$myaddr = $_GET['address'];
elseif(local_user()) {
if(strlen($a->path)) {
elseif (local_user()) {
if (strlen($a->path)) {
$myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
}
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(&$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(&$a) {
return;
}
if(! x($a->page,'aside'))
if (! x($a->page,'aside')) {
$a->page['aside'] = '';
}
$a->page['aside'] .= findpeople_widget();
@ -31,7 +32,7 @@ function dirfind_content(&$a, $prefix = "") {
$search = $prefix.notags(trim($_REQUEST['search']));
if(strpos($search,'@') === 0) {
if (strpos($search,'@') === 0) {
$search = substr($search,1);
$header = sprintf( t('People Search - %s'), $search);
if ((valid_email($search) AND validate_email($search)) OR
@ -41,7 +42,7 @@ function dirfind_content(&$a, $prefix = "") {
}
}
if(strpos($search,'!') === 0) {
if (strpos($search,'!') === 0) {
$search = substr($search,1);
$community = true;
$header = sprintf( t('Forum Search - %s'), $search);
@ -49,7 +50,7 @@ function dirfind_content(&$a, $prefix = "") {
$o = '';
if($search) {
if ($search) {
if ($discover_user) {
$j = new stdClass();
@ -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"]))
continue;
if (poco_alternate_ostatus_url($result["url"])) {
continue;
}
$result = get_contact_details_by_url($result["url"], local_user(), $result);
@ -167,16 +173,16 @@ function dirfind_content(&$a, $prefix = "") {
$j = json_decode($x);
}
if($j->total) {
if ($j->total) {
$a->set_pager_total($j->total);
$a->set_pager_itemspage($j->items_page);
}
if(count($j->results)) {
if (count($j->results)) {
$id = 0;
foreach($j->results as $jj) {
foreach ($j->results as $jj) {
$alt_text = "";
@ -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

@ -253,15 +253,15 @@ function events_content(&$a) {
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc > 1) {
if($a->argc > 2 && $a->argv[1] == 'event') {
if ($a->argc > 2 && $a->argv[1] == 'event') {
$mode = 'edit';
$event_id = intval($a->argv[2]);
}
if($a->argv[1] === 'new') {
if ($a->argv[1] === 'new') {
$mode = 'new';
$event_id = 0;
}
if($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
$mode = 'view';
$y = intval($a->argv[1]);
$m = intval($a->argv[2]);
@ -269,23 +269,27 @@ function events_content(&$a) {
}
// The view mode part is similiar to /mod/cal.php
if($mode == 'view') {
if ($mode == 'view') {
$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;
@ -341,7 +345,7 @@ function events_content(&$a) {
$r = sort_by_date($r);
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
if(! x($links,$j)) {
if (! x($links,$j)) {
$links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}

View file

@ -1170,13 +1170,14 @@ function settings_content(&$a) {
));
}
if(strlen(get_config('system','directory'))) {
if (strlen(get_config('system','directory'))) {
$profile_in_net_dir = replace_macros($opt_tpl,array(
'$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(