Coding convention:

- added curly braces
- added 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 10:35:28 +01:00
parent 5a90e7f822
commit a5e4882e25
11 changed files with 85 additions and 53 deletions

View File

@ -229,13 +229,16 @@ function profile_sidebar($profile, $block = 0) {
// Is the local user already connected to that user? // Is the local user already connected to that user?
if ($connect AND local_user()) { if ($connect AND local_user()) {
if (isset($profile["url"])) if (isset($profile["url"])) {
$profile_url = normalise_link($profile["url"]); $profile_url = normalise_link($profile["url"]);
else }
else {
$profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]); $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
}
$r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'", $r = q("SELECT * FROM `contact` WHERE NOT `pending` AND `uid` = %d AND `nurl` = '%s'",
local_user(), $profile_url); local_user(), $profile_url);
if (dbm::is_result($r)) if (dbm::is_result($r))
$connect = false; $connect = false;
} }
@ -684,8 +687,9 @@ function advanced_profile(&$a) {
$profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid)); $profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid));
} }
if ($a->profile['uid'] == local_user()) if ($a->profile['uid'] == local_user()) {
$profile['edit'] = array(App::get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); $profile['edit'] = array(App::get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile'));
}
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$title' => t('Profile'), '$title' => t('Profile'),

View File

@ -412,9 +412,10 @@ function get_theme_info($theme){
function get_theme_screenshot($theme) { function get_theme_screenshot($theme) {
$exts = array('.png','.jpg'); $exts = array('.png','.jpg');
foreach($exts as $ext) { foreach($exts as $ext) {
if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext); return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
} }
}
return(App::get_baseurl() . '/images/blank.png'); return(App::get_baseurl() . '/images/blank.png');
} }

View File

@ -32,10 +32,9 @@ function admin_post(&$a){
// do not allow a page manager to access the admin panel at all. // do not allow a page manager to access the admin panel at all.
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return; return;
}
// urls // urls
if ($a->argc > 1) { if ($a->argc > 1) {
@ -134,8 +133,9 @@ function admin_content(&$a) {
return login(false); return login(false);
} }
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return ""; return "";
}
// APC deactivated, since there are problems with PHP 5.5 // APC deactivated, since there are problems with PHP 5.5
//if (function_exists("apc_delete")) { //if (function_exists("apc_delete")) {

View File

@ -231,10 +231,11 @@ function cal_content(&$a) {
$r = sort_by_date($r); $r = sort_by_date($r);
foreach($r as $rr) { foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); $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; $links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
} }
} }
}
$events=array(); $events=array();

View File

@ -742,10 +742,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
} }
} }
if(local_user() && link_compare($a->contact['url'],$item['author-link'])) if (local_user() && link_compare($a->contact['url'],$item['author-link'])) {
$edpost = array(App::get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); $edpost = array(App::get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
else } else {
$edpost = false; $edpost = false;
}
$drop = ''; $drop = '';
$dropping = false; $dropping = false;
@ -782,6 +783,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
intval($item['uid']), intval($item['uid']),
intval($item['id']) intval($item['id'])
); );
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
$ignore = array( $ignore = array(
'do' => t("ignore thread"), 'do' => t("ignore thread"),
@ -818,19 +820,22 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
$sp = false; $sp = false;
$profile_link = best_link_url($item,$sp); $profile_link = best_link_url($item,$sp);
if($profile_link === 'mailbox') if ($profile_link === 'mailbox') {
$profile_link = ''; $profile_link = '';
if($sp) }
if ($sp) {
$sparkle = ' sparkle'; $sparkle = ' sparkle';
else } else {
$profile_link = zrl($profile_link); $profile_link = zrl($profile_link);
}
// Don't rely on the author-avatar. It is better to use the data from the contact table // Don't rely on the author-avatar. It is better to use the data from the contact table
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner); $author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
if ($author_contact["thumb"]) if ($author_contact["thumb"]) {
$profile_avatar = $author_contact["thumb"]; $profile_avatar = $author_contact["thumb"];
else } else {
$profile_avatar = $item['author-avatar']; $profile_avatar = $item['author-avatar'];
}
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : ''); $like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : ''); $dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');

View File

@ -17,8 +17,9 @@ function delegate_content(&$a) {
// delegated admins can view but not change delegation permissions // delegated admins can view but not change delegation permissions
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
}
$id = $a->argv[2]; $id = $a->argv[2];
@ -45,8 +46,9 @@ function delegate_content(&$a) {
// delegated admins can view but not change delegation permissions // delegated admins can view but not change delegation permissions
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
goaway(App::get_baseurl() . '/delegate'); goaway(App::get_baseurl() . '/delegate');
}
q("delete from manage where uid = %d and mid = %d limit 1", q("delete from manage where uid = %d and mid = %d limit 1",
intval($a->argv[2]), intval($a->argv[2]),

View File

@ -661,10 +661,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT `photo` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($dfrn_record)); intval($dfrn_record));
if (dbm::is_result($r)) if (dbm::is_result($r)) {
$photo = $r[0]['photo']; $photo = $r[0]['photo'];
else } else {
$photo = App::get_baseurl() . '/images/person-175.jpg'; $photo = App::get_baseurl() . '/images/person-175.jpg';
}
require_once("include/Photo.php"); require_once("include/Photo.php");
@ -673,11 +674,13 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
logger('dfrn_confirm: request - photos imported'); logger('dfrn_confirm: request - photos imported');
$new_relation = CONTACT_IS_SHARING; $new_relation = CONTACT_IS_SHARING;
if(($relation == CONTACT_IS_FOLLOWER) || ($duplex)) if (($relation == CONTACT_IS_FOLLOWER) || ($duplex)) {
$new_relation = CONTACT_IS_FRIEND; $new_relation = CONTACT_IS_FRIEND;
}
if(($relation == CONTACT_IS_FOLLOWER) && ($duplex)) if (($relation == CONTACT_IS_FOLLOWER) && ($duplex)) {
$duplex = 0; $duplex = 0;
}
$r = q("UPDATE `contact` SET $r = q("UPDATE `contact` SET
`rel` = %d, `rel` = %d,

View File

@ -336,10 +336,11 @@ function events_content(&$a) {
$r = sort_by_date($r); $r = sort_by_date($r);
foreach($r as $rr) { foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); $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; $links[$j] = App::get_baseurl() . '/' . $a->cmd . '#link-' . $j;
} }
} }
}
$events=array(); $events=array();

View File

@ -2,20 +2,25 @@
function removeme_post(&$a) { function removeme_post(&$a) {
if(! local_user()) if (! local_user()) {
return; return;
}
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return; return;
}
if((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password'])))) if ((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password'])))) {
return; return;
}
if((! x($_POST,'verify')) || (! strlen(trim($_POST['verify'])))) if ((! x($_POST,'verify')) || (! strlen(trim($_POST['verify'])))) {
return; return;
}
if($_POST['verify'] !== $_SESSION['remove_account_verify']) if ($_POST['verify'] !== $_SESSION['remove_account_verify']) {
return; return;
}
$encrypted = hash('whirlpool',trim($_POST['qxz_password'])); $encrypted = hash('whirlpool',trim($_POST['qxz_password']));
@ -29,8 +34,9 @@ function removeme_post(&$a) {
function removeme_content(&$a) { function removeme_content(&$a) {
if(! local_user()) if (! local_user()) {
goaway(z_root()); goaway(z_root());
}
$hash = random_string(); $hash = random_string();

View File

@ -121,8 +121,9 @@ function settings_post(&$a) {
if(! local_user()) if(! local_user())
return; return;
if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
return; return;
}
if (count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) { if (count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -118,14 +118,18 @@ class Item extends BaseObject {
: false); : false);
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false); $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false);
if (local_user() && link_compare($a->contact['url'],$item['author-link'])) { if (local_user() && link_compare($a->contact['url'],$item['author-link'])) {
if ($item["event-id"] != 0) if ($item["event-id"] != 0) {
$edpost = array("events/event/".$item['event-id'], t("Edit")); $edpost = array("events/event/".$item['event-id'], t("Edit"));
else } else {
$edpost = array("editpost/".$item['id'], t("Edit")); $edpost = array("editpost/".$item['id'], t("Edit"));
} else }
} else {
$edpost = false; $edpost = false;
if(($this->get_data_value('uid') == local_user()) || $this->is_visiting()) }
if (($this->get_data_value('uid') == local_user()) || $this->is_visiting()) {
$dropping = true; $dropping = true;
}
$drop = array( $drop = array(
'dropping' => $dropping, 'dropping' => $dropping,
@ -143,28 +147,32 @@ class Item extends BaseObject {
$sp = false; $sp = false;
$profile_link = best_link_url($item,$sp); $profile_link = best_link_url($item,$sp);
if($profile_link === 'mailbox') if ($profile_link === 'mailbox') {
$profile_link = ''; $profile_link = '';
if($sp) }
if ($sp) {
$sparkle = ' sparkle'; $sparkle = ' sparkle';
else } else {
$profile_link = zrl($profile_link); $profile_link = zrl($profile_link);
}
if (!isset($item['author-thumb']) OR ($item['author-thumb'] == "")) { if (!isset($item['author-thumb']) OR ($item['author-thumb'] == "")) {
$author_contact = get_contact_details_by_url($item['author-link'], $conv->get_profile_owner()); $author_contact = get_contact_details_by_url($item['author-link'], $conv->get_profile_owner());
if ($author_contact["thumb"]) if ($author_contact["thumb"]) {
$item['author-thumb'] = $author_contact["thumb"]; $item['author-thumb'] = $author_contact["thumb"];
else } else {
$item['author-thumb'] = $item['author-avatar']; $item['author-thumb'] = $item['author-avatar'];
} }
}
if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) { if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) {
$owner_contact = get_contact_details_by_url($item['owner-link'], $conv->get_profile_owner()); $owner_contact = get_contact_details_by_url($item['owner-link'], $conv->get_profile_owner());
if ($owner_contact["thumb"]) if ($owner_contact["thumb"]) {
$item['owner-thumb'] = $owner_contact["thumb"]; $item['owner-thumb'] = $owner_contact["thumb"];
else } else {
$item['owner-thumb'] = $item['owner-avatar']; $item['owner-thumb'] = $item['owner-avatar'];
} }
}
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location',$locate); call_hooks('render_location',$locate);