Continued with coding convention:
- added curly braces around conditional code blocks - added space between if/foreach/... and brace - made some SQL keywords upper-cased and added back-ticks to columns/table names Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
bb06d9ce32
commit
b4bc07fdcc
9 changed files with 78 additions and 56 deletions
15
mod/item.php
15
mod/item.php
|
@ -645,8 +645,9 @@ function item_post(&$a) {
|
|||
intval($mtch)
|
||||
);
|
||||
if (dbm::is_result($r)) {
|
||||
if(strlen($attachments))
|
||||
if (strlen($attachments)) {
|
||||
$attachments .= ',';
|
||||
}
|
||||
$attachments .= '[attach]href="' . App::get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
|
||||
}
|
||||
$body = str_replace($match[1],'',$body);
|
||||
|
@ -655,14 +656,17 @@ function item_post(&$a) {
|
|||
|
||||
$wall = 0;
|
||||
|
||||
if($post_type === 'wall' || $post_type === 'wall-comment')
|
||||
if ($post_type === 'wall' || $post_type === 'wall-comment') {
|
||||
$wall = 1;
|
||||
}
|
||||
|
||||
if(! strlen($verb))
|
||||
if (! strlen($verb)) {
|
||||
$verb = ACTIVITY_POST ;
|
||||
}
|
||||
|
||||
if ($network == "")
|
||||
if ($network == "") {
|
||||
$network = NETWORK_DFRN;
|
||||
}
|
||||
|
||||
$gravity = (($parent) ? 6 : 0 );
|
||||
|
||||
|
@ -676,8 +680,9 @@ function item_post(&$a) {
|
|||
$uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid));
|
||||
|
||||
// Fallback so that we alway have a thr-parent
|
||||
if(!$thr_parent)
|
||||
if (!$thr_parent) {
|
||||
$thr_parent = $uri;
|
||||
}
|
||||
|
||||
$datarray = array();
|
||||
$datarray['uid'] = $profile_uid;
|
||||
|
|
|
@ -26,7 +26,6 @@ function noscrape_init(&$a) {
|
|||
$keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
|
||||
$keywords = explode(',', $keywords);
|
||||
|
||||
/// @TODO This query's result is not being used (see below), maybe old-lost code?
|
||||
$r = q("SELECT `photo` FROM `contact` WHERE `self` AND `uid` = %d",
|
||||
intval($a->profile['uid']));
|
||||
|
||||
|
|
|
@ -627,7 +627,7 @@ function settings_post(&$a) {
|
|||
);
|
||||
}
|
||||
|
||||
if(($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
|
||||
if (($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
|
||||
// Update global directory in background
|
||||
$url = $_SESSION['my_url'];
|
||||
if ($url && strlen(get_config('system','directory'))) {
|
||||
|
@ -642,10 +642,10 @@ function settings_post(&$a) {
|
|||
update_gcontact_for_user(local_user());
|
||||
|
||||
//$_SESSION['theme'] = $theme;
|
||||
if($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
||||
if ($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
||||
|
||||
// FIXME - set to un-verified, blocked and redirect to logout
|
||||
// Why? Are we verifying people or email addresses?
|
||||
/// @TODO set to un-verified, blocked and redirect to logout
|
||||
/// @TODO Why? Are we verifying people or email addresses?
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ function starred_init(&$a) {
|
|||
killme();
|
||||
}
|
||||
|
||||
$r = q("SELECT starred FROM item WHERE uid = %d AND id = %d LIMIT 1",
|
||||
$r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
intval(local_user()),
|
||||
intval($message_id)
|
||||
);
|
||||
|
@ -25,10 +25,11 @@ function starred_init(&$a) {
|
|||
killme();
|
||||
}
|
||||
|
||||
if(! intval($r[0]['starred']))
|
||||
if (! intval($r[0]['starred'])) {
|
||||
$starred = 1;
|
||||
}
|
||||
|
||||
$r = q("UPDATE item SET starred = %d WHERE uid = %d and id = %d",
|
||||
$r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
|
||||
intval($starred),
|
||||
intval(local_user()),
|
||||
intval($message_id)
|
||||
|
@ -38,10 +39,14 @@ function starred_init(&$a) {
|
|||
|
||||
// See if we've been passed a return path to redirect to
|
||||
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
|
||||
if($return_path) {
|
||||
if ($return_path) {
|
||||
$rand = '_=' . time();
|
||||
if(strpos($return_path, '?')) $rand = "&$rand";
|
||||
else $rand = "?$rand";
|
||||
if (strpos($return_path, '?')) {
|
||||
$rand = "&$rand";
|
||||
}
|
||||
else {
|
||||
$rand = "?$rand";
|
||||
}
|
||||
|
||||
goaway(App::get_baseurl() . "/" . $return_path . $rand);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,9 @@ function subthread_content(&$a) {
|
|||
if (! dbm::is_result($r)) {
|
||||
return;
|
||||
}
|
||||
if(! $r[0]['self'])
|
||||
if (! $r[0]['self']) {
|
||||
$remote_owner = $r[0];
|
||||
}
|
||||
}
|
||||
|
||||
// this represents the post owner on this system.
|
||||
|
@ -57,18 +58,18 @@ function subthread_content(&$a) {
|
|||
if (dbm::is_result($r))
|
||||
$owner = $r[0];
|
||||
|
||||
if(! $owner) {
|
||||
if (! $owner) {
|
||||
logger('like: no owner');
|
||||
return;
|
||||
}
|
||||
|
||||
if(! $remote_owner)
|
||||
if (! $remote_owner)
|
||||
$remote_owner = $owner;
|
||||
|
||||
|
||||
// This represents the person posting
|
||||
|
||||
if((local_user()) && (local_user() == $owner_uid)) {
|
||||
if ((local_user()) && (local_user() == $owner_uid)) {
|
||||
$contact = $owner;
|
||||
}
|
||||
else {
|
||||
|
@ -79,7 +80,7 @@ function subthread_content(&$a) {
|
|||
if (dbm::is_result($r))
|
||||
$contact = $r[0];
|
||||
}
|
||||
if(! $contact) {
|
||||
if (! $contact) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,8 +104,9 @@ function subthread_content(&$a) {
|
|||
EOT;
|
||||
$bodyverb = t('%1$s is following %2$s\'s %3$s');
|
||||
|
||||
if(! isset($bodyverb))
|
||||
return;
|
||||
if (! isset($bodyverb)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
|
||||
|
@ -144,7 +146,7 @@ EOT;
|
|||
|
||||
$post_id = item_store($arr);
|
||||
|
||||
if(! $item['visible']) {
|
||||
if (! $item['visible']) {
|
||||
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||
intval($item['id']),
|
||||
intval($owner_uid)
|
||||
|
|
|
@ -94,8 +94,9 @@ EOT;
|
|||
|
||||
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
|
||||
|
||||
if(! isset($bodyverb))
|
||||
return;
|
||||
if (! isset($bodyverb)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$termlink = html_entity_decode('⌗') . '[url=' . App::get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]';
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ function tagrm_content(&$a) {
|
|||
}
|
||||
|
||||
$item = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||
if(! $item) {
|
||||
if (! $item) {
|
||||
goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -87,8 +87,7 @@ function tagrm_content(&$a) {
|
|||
$o .= '<input type="hidden" name="item" value="' . $item . '" />';
|
||||
$o .= '<ul>';
|
||||
|
||||
|
||||
foreach($arr as $x) {
|
||||
foreach ($arr as $x) {
|
||||
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . bbcode($x) . '</input></li>';
|
||||
}
|
||||
|
||||
|
@ -98,5 +97,5 @@ function tagrm_content(&$a) {
|
|||
$o .= '</form>';
|
||||
|
||||
return $o;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -41,13 +41,15 @@ function xrd_init(&$a) {
|
|||
|
||||
$profile_url = App::get_baseurl().'/profile/'.$r[0]['nickname'];
|
||||
|
||||
if ($acct)
|
||||
if ($acct) {
|
||||
$alias = $profile_url;
|
||||
}
|
||||
else {
|
||||
$alias = 'acct:'.$r[0]['nickname'].'@'.$a->get_hostname();
|
||||
|
||||
if ($a->get_path())
|
||||
if ($a->get_path()) {
|
||||
$alias .= '/'.$a->get_path();
|
||||
}
|
||||
}
|
||||
|
||||
$o = replace_macros($tpl, array(
|
||||
|
@ -65,7 +67,7 @@ function xrd_init(&$a) {
|
|||
'$salmen' => App::get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention',
|
||||
'$subscribe' => App::get_baseurl() . '/follow?url={uri}',
|
||||
'$modexp' => 'data:application/magic-public-key,' . $salmon_key,
|
||||
'$bigkey' => salmon_key($r[0]['pubkey'])
|
||||
'$bigkey' => salmon_key($r[0]['pubkey']),
|
||||
));
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue