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 e1f3661645
commit 98b7270295
53 changed files with 117 additions and 87 deletions

View File

@ -1028,7 +1028,7 @@ class App {
} else { } else {
$r = q("SELECT `contact`.`avatar-date` AS picdate FROM `contact` WHERE `contact`.`thumb` like '%%/%s'", $r = q("SELECT `contact`.`avatar-date` AS picdate FROM `contact` WHERE `contact`.`thumb` like '%%/%s'",
$common_filename); $common_filename);
if(! dbm::is_result($r)){ if (! dbm::is_result($r)) {
$this->cached_profile_image[$avatar_image] = $avatar_image; $this->cached_profile_image[$avatar_image] = $avatar_image;
} else { } else {
$this->cached_profile_picdate[$common_filename] = "?rev=".urlencode($r[0]['picdate']); $this->cached_profile_picdate[$common_filename] = "?rev=".urlencode($r[0]['picdate']);

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

@ -254,7 +254,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$result['message'] .= t('Unable to retrieve contact information.') . EOL; $result['message'] .= t('Unable to retrieve contact information.') . EOL;
return $result; return $result;
} }

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,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
); );
$got_lock = true; $got_lock = true;
} }
elseif(! dbm::is_result($r)) { elseif (! dbm::is_result($r)) {
/// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $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),

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

@ -330,7 +330,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
intval($gcid), intval($gcid),
intval($zcid) intval($zcid)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
q("INSERT INTO `glink` (`cid`,`uid`,`gcid`,`zcid`, `updated`) VALUES (%d,%d,%d,%d, '%s') ", q("INSERT INTO `glink` (`cid`,`uid`,`gcid`,`zcid`, `updated`) VALUES (%d,%d,%d,%d, '%s') ",
intval($cid), intval($cid),
intval($uid), intval($uid),

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'])),
@ -2020,11 +2021,11 @@ function file_tag_unsave_file($uid,$item,$file,$cat = false) {
//$r = q("select file from item where uid = %d and deleted = 0 " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')), //$r = q("select file from item where uid = %d and deleted = 0 " . file_tag_file_query('item',$file,(($cat) ? 'category' : 'file')),
//); //);
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

@ -39,7 +39,7 @@ function allfriends_content(&$a) {
$r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']); $r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$o .= t('No friends to display.'); $o .= t('No friends to display.');
return $o; return $o;
} }

View File

@ -16,7 +16,7 @@ function attach_init(&$a) {
$r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `attach` WHERE `id` = %d LIMIT 1",
intval($item_id) intval($item_id)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Item was not found.'). EOL); notice( t('Item was not found.'). EOL);
return; return;
} }
@ -29,7 +29,7 @@ function attach_init(&$a) {
dbesc($item_id) dbesc($item_id)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }

View File

@ -94,7 +94,7 @@ function common_content(&$a) {
$r = common_friends_zcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']); $r = common_friends_zcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
return $o; return $o;
} }

View File

@ -71,7 +71,7 @@ function community_content(&$a, $update = 0) {
$r = community_getitems($a->pager['start'], $a->pager['itemspage']); $r = community_getitems($a->pager['start'], $a->pager['itemspage']);
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
info( t('No results.') . EOL); info( t('No results.') . EOL);
return $o; return $o;
} }

View File

@ -24,7 +24,7 @@ function contactgroup_content(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
killme(); killme();
} }

View File

@ -19,7 +19,7 @@ function contacts_init(&$a) {
intval(local_user()), intval(local_user()),
intval($contact_id) intval($contact_id)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$contact_id = 0; $contact_id = 0;
} }
} }
@ -169,7 +169,7 @@ function contacts_post(&$a) {
intval($profile_id), intval($profile_id),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Could not locate selected profile.') . EOL); notice( t('Could not locate selected profile.') . EOL);
return; return;
} }

View File

@ -113,7 +113,7 @@ function content_content(&$a, $update = 0) {
intval($group), intval($group),
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
if($update) if($update)
killme(); killme();
notice( t('No such group') . EOL ); notice( t('No such group') . EOL );

View File

@ -14,7 +14,7 @@ function crepair_init(&$a) {
intval(local_user()), intval(local_user()),
intval($contact_id) intval($contact_id)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$contact_id = 0; $contact_id = 0;
} }
} }
@ -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];
@ -110,7 +111,7 @@ function crepair_content(&$a) {
); );
} }
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL); notice( t('Contact not found.') . EOL);
return; return;
} }

View File

@ -97,7 +97,7 @@ function delegate_content(&$a) {
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('No potential page delegates located.') . EOL); notice( t('No potential page delegates located.') . EOL);
return; return;
} }

View File

@ -121,7 +121,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('Contact not found in DB.'); logger('Contact not found in DB.');
notice( t('Contact not found.') . EOL ); notice( t('Contact not found.') . EOL );
notice( t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL ); notice( t('This may occasionally happen if contact was requested by both persons and it has already been approved.') . EOL );
@ -553,7 +553,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($node)); dbesc($node));
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$message = sprintf(t('No user record found for \'%s\' '), $node); $message = sprintf(t('No user record found for \'%s\' '), $node);
xml_status(3,$message); // failure xml_status(3,$message); // failure
// NOTREACHED // NOTREACHED
@ -640,7 +640,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc($dfrn_pubkey), dbesc($dfrn_pubkey),
intval($dfrn_record) intval($dfrn_record)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$message = t('Unable to set your contact credentials on our system.'); $message = t('Unable to set your contact credentials on our system.');
xml_status(3,$message); xml_status(3,$message);
} }

View File

@ -42,7 +42,7 @@ function dfrn_notify_post(&$a) {
dbesc($dfrn_id), dbesc($dfrn_id),
dbesc($challenge) dbesc($challenge)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge); logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
xml_status(3); xml_status(3);
} }
@ -88,7 +88,7 @@ function dfrn_notify_post(&$a) {
dbesc($a->argv[1]) dbesc($a->argv[1])
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('dfrn_notify: contact not found for dfrn_id ' . $dfrn_id); logger('dfrn_notify: contact not found for dfrn_id ' . $dfrn_id);
xml_status(3); xml_status(3);
//NOTREACHED //NOTREACHED
@ -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

@ -126,7 +126,7 @@ function dfrn_poll_init(&$a) {
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec) dbesc($sec)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
xml_status(3, 'No ticket'); xml_status(3, 'No ticket');
// NOTREACHED // NOTREACHED
} }
@ -223,7 +223,7 @@ function dfrn_poll_post(&$a) {
$r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1", $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
dbesc($sec) dbesc($sec)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
xml_status(3, 'No ticket'); xml_status(3, 'No ticket');
// NOTREACHED // NOTREACHED
} }
@ -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

@ -371,7 +371,7 @@ function dfrn_request_post(&$a) {
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('This account has not been configured for email. Request failed.') . EOL); notice( t('This account has not been configured for email. Request failed.') . EOL);
return; return;
} }
@ -842,8 +842,9 @@ 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

View File

@ -16,7 +16,7 @@ function fsuggest_post(&$a) {
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL); notice( t('Contact not found.') . EOL);
return; return;
} }
@ -88,7 +88,7 @@ function fsuggest_content(&$a) {
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Contact not found.') . EOL); notice( t('Contact not found.') . EOL);
return; return;
} }

View File

@ -43,7 +43,7 @@ function group_post(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Group not found.') . EOL ); notice( t('Group not found.') . EOL );
goaway(App::get_baseurl() . '/contacts'); goaway(App::get_baseurl() . '/contacts');
return; // NOTREACHED return; // NOTREACHED
@ -136,7 +136,7 @@ function group_content(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Group not found.') . EOL ); notice( t('Group not found.') . EOL );
goaway(App::get_baseurl() . '/contacts'); goaway(App::get_baseurl() . '/contacts');
} }

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

@ -112,7 +112,7 @@ function item_post(&$a) {
} }
} }
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Unable to locate original post.') . EOL); notice( t('Unable to locate original post.') . EOL);
if(x($_REQUEST,'return')) if(x($_REQUEST,'return'))
goaway($return_path); goaway($return_path);
@ -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

@ -15,7 +15,7 @@ function lostpass_post(&$a) {
dbesc($loginame) dbesc($loginame)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('No valid account found.') . EOL); notice( t('No valid account found.') . EOL);
goaway(z_root()); goaway(z_root());
} }
@ -87,7 +87,7 @@ function lostpass_content(&$a) {
$r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1",
dbesc($hash) dbesc($hash)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$o = t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."); $o = t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.");
return $o; return $o;
} }

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

@ -381,7 +381,7 @@ function message_content(&$a) {
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']); $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
info( t('No messages.') . EOL); info( t('No messages.') . EOL);
return $o; return $o;
} }

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

@ -126,7 +126,7 @@ function network_init(&$a) {
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
q("INSERT INTO `search` ( `uid`,`term` ) VALUES ( %d, '%s') ", q("INSERT INTO `search` ( `uid`,`term` ) VALUES ( %d, '%s') ",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
@ -463,7 +463,7 @@ function network_content(&$a, $update = 0) {
intval($group), intval($group),
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
if($update) if($update)
killme(); killme();
notice( t('No such group') . EOL ); notice( t('No such group') . EOL );

View File

@ -52,7 +52,7 @@ function poke_init(&$a) {
intval($uid) intval($uid)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('poke: no contact ' . $contact_id); logger('poke: no contact ' . $contact_id);
return; return;
} }

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

@ -15,7 +15,7 @@ function profiles_init(&$a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
goaway('profiles'); goaway('profiles');
return; // NOTREACHED return; // NOTREACHED
@ -130,7 +130,7 @@ function profiles_init(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
killme(); killme();
return; return;
@ -613,7 +613,7 @@ function profiles_content(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Profile not found.') . EOL); notice( t('Profile not found.') . EOL);
return; return;
} }

View File

@ -52,7 +52,7 @@ function profperm_content(&$a) {
intval($a->argv[1]), intval($a->argv[1]),
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('Invalid profile identifier.') . EOL ); notice( t('Invalid profile identifier.') . EOL );
return; return;
} }

View File

@ -47,7 +47,7 @@ function pubsub_init(&$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)) {
logger('pubsub: local account not found: ' . $nick); logger('pubsub: local account not found: ' . $nick);
hub_return(false, ''); hub_return(false, '');
} }
@ -62,7 +62,7 @@ function pubsub_init(&$a) {
intval($contact_id), intval($contact_id),
intval($owner['uid']) intval($owner['uid'])
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('pubsub: contact '.$contact_id.' not found.'); logger('pubsub: contact '.$contact_id.' not found.');
hub_return(false, ''); hub_return(false, '');
} }
@ -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];
@ -131,7 +132,7 @@ function pubsub_post(&$a) {
dbesc(NETWORK_FEED) dbesc(NETWORK_FEED)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('pubsub: no contact record for "'.$nick.' ('.$contact_id.')" - ignored. '.$xml); logger('pubsub: no contact record for "'.$nick.' ('.$contact_id.')" - ignored. '.$xml);
hub_post_return(); hub_post_return();
} }

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];
@ -150,7 +151,7 @@ function salmon_post(&$a) {
dbesc(normalise_link($author_link)), dbesc(normalise_link($author_link)),
intval($importer['uid']) intval($importer['uid'])
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('mod-salmon: Author unknown to us.'); logger('mod-salmon: Author unknown to us.');
if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) { if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
$result = new_contact($importer['uid'],$author_link); $result = new_contact($importer['uid'],$author_link);

View File

@ -53,7 +53,7 @@ function search_init(&$a) {
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')", q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
@ -219,7 +219,7 @@ function search_content(&$a) {
intval($a->pager['start']), intval($a->pager['itemspage'])); intval($a->pager['start']), intval($a->pager['itemspage']));
} }
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
info( t('No results.') . EOL); info( t('No results.') . EOL);
return $o; return $o;
} }

View File

@ -225,7 +225,7 @@ function settings_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
q("INSERT INTO `mailacct` (`uid`) VALUES (%d)", q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
intval(local_user()) intval(local_user())
); );
@ -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

@ -67,7 +67,7 @@ function suggest_content(&$a) {
$r = suggestion_query(local_user()); $r = suggestion_query(local_user());
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.'); $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
return $o; return $o;
} }

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

@ -12,7 +12,7 @@ function wall_attach_post(&$a) {
$r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1", $r = q("SELECT `user`.*, `contact`.`id` FROM `user` LEFT JOIN `contact` on `user`.`uid` = `contact`.`uid` WHERE `user`.`nickname` = '%s' AND `user`.`blocked` = 0 and `contact`.`self` = 1 LIMIT 1",
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)){ if (! dbm::is_result($r)) {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
killme(); killme();
@ -168,7 +168,7 @@ function wall_attach_post(&$a) {
dbesc($hash) dbesc($hash)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
$msg = t('File upload failed.'); $msg = t('File upload failed.');
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>$msg)); echo json_encode(array('error'=>$msg));

View File

@ -15,7 +15,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
dbesc($nick) dbesc($nick)
); );
if(! dbm::is_result($r)){ if (! dbm::is_result($r)) {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>t('Invalid request.'))); echo json_encode(array('error'=>t('Invalid request.')));
killme(); killme();

View File

@ -22,7 +22,7 @@ function wallmessage_post(&$a) {
dbesc($recipient) dbesc($recipient)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
logger('wallmessage: no recipient'); logger('wallmessage: no recipient');
return; return;
} }
@ -91,7 +91,7 @@ function wallmessage_content(&$a) {
dbesc($recipient) dbesc($recipient)
); );
if(! dbm::is_result($r)) { if (! dbm::is_result($r)) {
notice( t('No recipient.') . EOL); notice( t('No recipient.') . EOL);
logger('wallmessage: no recipient'); logger('wallmessage: no recipient');
return; return;

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']);