Coding convention applied:

- space between "if" and brace
- curly braces on conditional blocks

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

Conflicts:
	include/lock.php
This commit is contained in:
Roland Häder 2016-12-20 10:10:33 +01:00
parent 884f44ce94
commit abff6372dd
53 changed files with 118 additions and 87 deletions

View File

@ -105,8 +105,9 @@ class dfrn {
dbesc($owner_nick) dbesc($owner_nick)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$owner = $r[0]; $owner = $r[0];
$owner_id = $owner['uid']; $owner_id = $owner['uid'];
@ -139,8 +140,9 @@ class dfrn {
intval($owner_id) intval($owner_id)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$contact = $r[0]; $contact = $r[0];
require_once('include/security.php'); require_once('include/security.php');

View File

@ -143,13 +143,14 @@ function group_add_member($uid,$name,$member,$gid = 0) {
return true; // You might question this, but return true; // You might question this, but
// we indicate success because the group member was in fact created // we indicate success because the group member was in fact created
// -- It was just created at another time // -- It was just created at another time
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
$r = q("INSERT INTO `group_member` (`uid`, `gid`, `contact-id`) $r = q("INSERT INTO `group_member` (`uid`, `gid`, `contact-id`)
VALUES( %d, %d, %d ) ", VALUES( %d, %d, %d ) ",
intval($uid), intval($uid),
intval($gid), intval($gid),
intval($member) intval($member)
); );
}
return $r; return $r;
} }

View File

@ -78,8 +78,9 @@ function do_like($item_id, $verb) {
intval($item['contact-id']), intval($item['contact-id']),
intval($item['uid']) intval($item['uid'])
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return false; return false;
}
if(! $r[0]['self']) if(! $r[0]['self'])
$remote_owner = $r[0]; $remote_owner = $r[0];
} }

View File

@ -23,7 +23,8 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
); );
$got_lock = true; $got_lock = true;
} }
elseif(! dbm::is_result($r)) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r elseif (! dbm::is_result($r)) {
/// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $r
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)", q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
dbesc($fn_name), dbesc($fn_name),
dbesc(datetime_convert()) dbesc(datetime_convert())

View File

@ -210,8 +210,9 @@ function notifier_run(&$argv, &$argc){
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
$owner = $r[0]; $owner = $r[0];

View File

@ -143,8 +143,9 @@ function onepoll_run(&$argv, &$argc){
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($importer_uid) intval($importer_uid)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
$importer = $r[0]; $importer = $r[0];

View File

@ -36,9 +36,9 @@ function auto_redir(&$a, $contact_nick) {
dbesc($nurl) dbesc($nurl)
); );
if((! dbm::is_result($r)) || $r[0]['id'] == remote_user()) if ((! dbm::is_result($r)) || $r[0]['id'] == remote_user()) {
return; return;
}
$r = q("SELECT * FROM contact WHERE nick = '%s' $r = q("SELECT * FROM contact WHERE nick = '%s'
AND network = '%s' AND uid = %d AND url LIKE '%%%s%%' LIMIT 1", AND network = '%s' AND uid = %d AND url LIKE '%%%s%%' LIMIT 1",
@ -48,8 +48,9 @@ function auto_redir(&$a, $contact_nick) {
dbesc($baseurl) dbesc($baseurl)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
$cid = $r[0]['id']; $cid = $r[0]['id'];

View File

@ -2000,8 +2000,9 @@ function file_tag_unsave_file($uid,$item,$file,$cat = false) {
intval($item), intval($item),
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return false; return false;
}
q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d", q("UPDATE `item` SET `file` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc(str_replace($pattern,'',$r[0]['file'])), dbesc(str_replace($pattern,'',$r[0]['file'])),
@ -2023,8 +2024,8 @@ function file_tag_unsave_file($uid,$item,$file,$cat = false) {
if (! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$saved = get_pconfig($uid,'system','filetags'); $saved = get_pconfig($uid,'system','filetags');
set_pconfig($uid,'system','filetags',str_replace($pattern,'',$saved)); set_pconfig($uid,'system','filetags',str_replace($pattern,'',$saved));
} }
return true; return true;
} }

View File

@ -43,8 +43,9 @@ function crepair_post(&$a) {
); );
} }
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
$contact = $r[0]; $contact = $r[0];

View File

@ -284,8 +284,9 @@ function dfrn_notify_content(&$a) {
dbesc($a->argv[1]) dbesc($a->argv[1])
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
$status = 1; $status = 1;
}
logger("Remote rino version: ".$rino_remote." for ".$r[0]["url"], LOGGER_DEBUG); logger("Remote rino version: ".$rino_remote." for ".$r[0]["url"], LOGGER_DEBUG);

View File

@ -284,8 +284,9 @@ function dfrn_poll_post(&$a) {
dbesc($challenge) dbesc($challenge)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$type = $r[0]['type']; $type = $r[0]['type'];
$last_update = $r[0]['last_update']; $last_update = $r[0]['last_update'];
@ -319,8 +320,9 @@ function dfrn_poll_post(&$a) {
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1"); $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1");
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$contact = $r[0]; $contact = $r[0];
$owner_uid = $r[0]['uid']; $owner_uid = $r[0]['uid'];

View File

@ -842,9 +842,10 @@ function dfrn_request_content(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($a->profile['uid']) intval($a->profile['uid'])
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
$mail_disabled = 1; $mail_disabled = 1;
} }
}
// "coming soon" is disabled for now // "coming soon" is disabled for now
//$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29")); //$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));

View File

@ -16,8 +16,9 @@ function ignored_init(&$a) {
intval(local_user()), intval(local_user()),
intval($message_id) intval($message_id)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
if(! intval($r[0]['ignored'])) if(! intval($r[0]['ignored']))
$ignored = 1; $ignored = 1;

View File

@ -464,8 +464,9 @@ function item_post(&$a) {
intval($profile_uid) intval($profile_uid)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
continue; continue;
}
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ", WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",

View File

@ -21,8 +21,9 @@ function lockview_content(&$a) {
dbesc($type), dbesc($type),
intval($item_id) intval($item_id)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$item = $r[0]; $item = $r[0];
call_hooks('lockview_content', $item); call_hooks('lockview_content', $item);

View File

@ -56,8 +56,9 @@ function manage_post(&$a) {
); );
} }
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
unset($_SESSION['authenticated']); unset($_SESSION['authenticated']);
unset($_SESSION['uid']); unset($_SESSION['uid']);

View File

@ -27,8 +27,9 @@ function match_content(&$a) {
$r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) { if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL); notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
return; return;

View File

@ -12,8 +12,9 @@ function modexp_init(&$a) {
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$lines = explode("\n",$r[0]['spubkey']); $lines = explode("\n",$r[0]['spubkey']);
unset($lines[0]); unset($lines[0]);

View File

@ -23,8 +23,9 @@ function post_post(&$a) {
AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
http_status_exit(500); http_status_exit(500);
}
$importer = $r[0]; $importer = $r[0];
} }

View File

@ -117,8 +117,9 @@ function pubsub_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
hub_post_return(); hub_post_return();
}
$importer = $r[0]; $importer = $r[0];

View File

@ -34,8 +34,9 @@ function receive_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", $r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($guid) dbesc($guid)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
http_status_exit(500); http_status_exit(500);
}
$importer = $r[0]; $importer = $r[0];
} }

View File

@ -31,8 +31,9 @@ function salmon_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
http_status_exit(500); http_status_exit(500);
}
$importer = $r[0]; $importer = $r[0];

View File

@ -752,8 +752,9 @@ function settings_content(&$a) {
$settings_addons = ""; $settings_addons = "";
$r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' "); $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
$settings_addons = t('No Plugin settings configured'); $settings_addons = t('No Plugin settings configured');
}
call_hooks('plugin_settings', $settings_addons); call_hooks('plugin_settings', $settings_addons);

View File

@ -18,8 +18,9 @@ function starred_init(&$a) {
intval(local_user()), intval(local_user()),
intval($message_id) intval($message_id)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
if(! intval($r[0]['starred'])) if(! intval($r[0]['starred']))
$starred = 1; $starred = 1;

View File

@ -41,8 +41,9 @@ function subthread_content(&$a) {
intval($item['contact-id']), intval($item['contact-id']),
intval($item['uid']) intval($item['uid'])
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
if(! $r[0]['self']) if(! $r[0]['self'])
$remote_owner = $r[0]; $remote_owner = $r[0];
} }

View File

@ -19,8 +19,9 @@ function tagrm_post(&$a) {
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
}
$arr = explode(',', $r[0]['tag']); $arr = explode(',', $r[0]['tag']);
for($x = 0; $x < count($arr); $x ++) { for($x = 0; $x < count($arr); $x ++) {
@ -68,8 +69,9 @@ function tagrm_content(&$a) {
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']); goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
}
$arr = explode(',', $r[0]['tag']); $arr = explode(',', $r[0]['tag']);

View File

@ -16,8 +16,9 @@ function viewcontacts_init(&$a) {
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
return; return;
}
$a->data['user'] = $r[0]; $a->data['user'] = $r[0];
$a->profile_uid = $r[0]['uid']; $a->profile_uid = $r[0]['uid'];

View File

@ -21,8 +21,9 @@ function xrd_init(&$a) {
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($name) dbesc($name)
); );
if(! dbm::is_result($r)) if (! dbm::is_result($r)) {
killme(); killme();
}
$salmon_key = salmon_key($r[0]['spubkey']); $salmon_key = salmon_key($r[0]['spubkey']);