Cleanup for #3010 - added spaces, thanks to @annando .

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-12-14 09:41:33 +01:00
parent dd8d797d9f
commit 46d383369c
53 changed files with 147 additions and 149 deletions

View File

@ -1121,7 +1121,7 @@ function admin_page_dbsync(&$a) {
$failed = array(); $failed = array();
$r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' "); $r = q("SELECT `k`, `v` FROM `config` WHERE `cat` = 'database' ");
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$upd = intval(substr($rr['k'],7)); $upd = intval(substr($rr['k'],7));
if($upd < 1139 || $rr['v'] === 'success') if($upd < 1139 || $rr['v'] === 'success')

View File

@ -132,7 +132,7 @@ function cal_content(&$a) {
intval($contact_id), intval($contact_id),
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -227,7 +227,7 @@ function cal_content(&$a) {
$links = array(); $links = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$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'));
@ -240,7 +240,7 @@ function cal_content(&$a) {
$events=array(); $events=array();
// transform the event in a usable array // transform the event in a usable array
if(dbm::is_result($r)) if (dbm::is_result($r))
$r = sort_by_date($r); $r = sort_by_date($r);
$events = process_events($r); $events = process_events($r);

View File

@ -57,13 +57,13 @@ function common_content(&$a) {
dbesc(normalise_link(get_my_url())), dbesc(normalise_link(get_my_url())),
intval($profile_uid) intval($profile_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$cid = $r[0]['id']; $cid = $r[0]['id'];
else { else {
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link(get_my_url())) dbesc(normalise_link(get_my_url()))
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$zcid = $r[0]['id']; $zcid = $r[0]['id'];
} }
} }

View File

@ -59,7 +59,7 @@ function community_content(&$a, $update = 0) {
AND `item`.`private` = 0 AND `item`.`wall` = 1" AND `item`.`private` = 0 AND `item`.`wall` = 1"
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
if(! $r[0]['total']) { if(! $r[0]['total']) {

View File

@ -14,7 +14,7 @@ function contactgroup_content(&$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))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }

View File

@ -765,7 +765,7 @@ function contacts_content(&$a) {
$r = q("SELECT COUNT(*) AS `total` FROM `contact` $r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$total = $r[0]['total']; $total = $r[0]['total'];
} }
@ -780,7 +780,7 @@ function contacts_content(&$a) {
$contacts = array(); $contacts = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
$contacts[] = _contact_detail_for_template($rr); $contacts[] = _contact_detail_for_template($rr);
} }

View File

@ -93,7 +93,7 @@ function content_content(&$a, $update = 0) {
); );
$str = ''; $str = '';
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$str .= '<' . $rr['id'] . '>'; $str .= '<' . $rr['id'] . '>';
if(strlen($str)) if(strlen($str))
@ -141,7 +141,7 @@ function content_content(&$a, $update = 0) {
AND `blocked` = 0 AND `pending` = 0 LIMIT 1", AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
intval($cid) intval($cid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) "; $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND `contact-id` = " . intval($cid) . " and deleted = 0 ) ";
} }
@ -259,7 +259,7 @@ function content_content(&$a, $update = 0) {
$parents_arr = array(); $parents_arr = array();
$parents_str = ''; $parents_str = '';
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr)) if(! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];

View File

@ -26,12 +26,12 @@ function delegate_content(&$a) {
$r = q("select `nickname` from user where uid = %d limit 1", $r = q("select `nickname` from user where uid = %d limit 1",
intval($id) intval($id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$r = q("select id from contact where uid = %d and nurl = '%s' limit 1", $r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
intval(local_user()), intval(local_user()),
dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname'])) dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname']))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
q("insert into manage ( uid, mid ) values ( %d , %d ) ", q("insert into manage ( uid, mid ) values ( %d , %d ) ",
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
@ -64,7 +64,7 @@ function delegate_content(&$a) {
dbesc($a->user['email']), dbesc($a->user['email']),
dbesc($a->user['password']) dbesc($a->user['password'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$full_managers = $r; $full_managers = $r;
$delegates = array(); $delegates = array();
@ -75,7 +75,7 @@ function delegate_content(&$a) {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$delegates = $r; $delegates = $r;
$uids = array(); $uids = array();
@ -104,7 +104,7 @@ function delegate_content(&$a) {
$nicknames = array(); $nicknames = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'"; $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
} }
@ -118,7 +118,7 @@ function delegate_content(&$a) {
$r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )"); $r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
if(! in_array($rr['uid'],$uids)) if(! in_array($rr['uid'],$uids))
$potentials[] = $rr; $potentials[] = $rr;

View File

@ -423,7 +423,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($contact_id) intval($contact_id)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$contact = $r[0]; $contact = $r[0];
else else
$contact = null; $contact = null;
@ -629,7 +629,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `dfrn-id` = '%s' LIMIT 1",
dbesc($decrypted_dfrn_id) dbesc($decrypted_dfrn_id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.'); $message = t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
xml_status(1,$message); // Birthday paradox - duplicate dfrn-id xml_status(1,$message); // Birthday paradox - duplicate dfrn-id
// NOTREACHED // NOTREACHED
@ -661,7 +661,7 @@ 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 = $a->get_baseurl() . '/images/person-175.jpg'; $photo = $a->get_baseurl() . '/images/person-175.jpg';
@ -714,7 +714,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
intval($dfrn_record) intval($dfrn_record)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$combined = $r[0]; $combined = $r[0];
if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) { if((dbm::is_result($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {

View File

@ -79,7 +79,7 @@ function dfrn_poll_init(&$a) {
dbesc($a->argv[1]) dbesc($a->argv[1])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check'); $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
@ -190,7 +190,7 @@ function dfrn_poll_init(&$a) {
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time())); q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC", $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
dbesc($dfrn_id)); dbesc($dfrn_id));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
xml_status(1); xml_status(1);
return; // NOTREACHED return; // NOTREACHED
} }
@ -335,7 +335,7 @@ function dfrn_poll_post(&$a) {
$reputation = 0; $reputation = 0;
$text = ''; $text = '';
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$reputation = $r[0]['rating']; $reputation = $r[0]['rating'];
$text = $r[0]['reason']; $text = $r[0]['reason'];
@ -448,7 +448,7 @@ function dfrn_poll_content(&$a) {
dbesc($nickname) dbesc($nickname)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$challenge = ''; $challenge = '';
$encrypted_id = ''; $encrypted_id = '';

View File

@ -91,7 +91,7 @@ function dfrn_request_post(&$a) {
dbesc(normalise_link($dfrn_url)) dbesc(normalise_link($dfrn_url))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(strlen($r[0]['dfrn-id'])) { if(strlen($r[0]['dfrn-id'])) {
/* /*
@ -185,7 +185,7 @@ function dfrn_request_post(&$a) {
dbesc($dfrn_url), dbesc($dfrn_url),
$parms['key'] // this was already escaped $parms['key'] // this was already escaped
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$def_gid = get_default_group(local_user(), $r[0]["network"]); $def_gid = get_default_group(local_user(), $r[0]["network"]);
if(intval($def_gid)) if(intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid); group_add_member(local_user(), '', $r[0]['id'], $def_gid);
@ -273,7 +273,7 @@ function dfrn_request_post(&$a) {
dbesc(datetime_convert('UTC','UTC','now - 24 hours')), dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
intval($uid) intval($uid)
); );
if(dbm::is_result($r) && count($r) > $maxreq) { if (dbm::is_result($r) && count($r) > $maxreq) {
notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL); notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL);
notice( t('Spam protection measures have been invoked.') . EOL); notice( t('Spam protection measures have been invoked.') . EOL);
notice( t('Friends are advised to please try again in 24 hours.') . EOL); notice( t('Friends are advised to please try again in 24 hours.') . EOL);
@ -295,7 +295,7 @@ function dfrn_request_post(&$a) {
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ", AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
dbesc(NETWORK_MAIL2) dbesc(NETWORK_MAIL2)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['rel']) { if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d", q("DELETE FROM `contact` WHERE `id` = %d",
@ -320,7 +320,7 @@ function dfrn_request_post(&$a) {
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ", AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL2) dbesc(NETWORK_MAIL2)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['rel']) { if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d", q("DELETE FROM `contact` WHERE `id` = %d",
@ -398,7 +398,7 @@ function dfrn_request_post(&$a) {
dbesc($poll), dbesc($poll),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact_id = $r[0]['id']; $contact_id = $r[0]['id'];
$def_gid = get_default_group($uid, $r[0]["network"]); $def_gid = get_default_group($uid, $r[0]["network"]);
@ -477,7 +477,7 @@ function dfrn_request_post(&$a) {
dbesc($url) dbesc($url)
); );
if(dbm::is_result($ret)) { if (dbm::is_result($ret)) {
if(strlen($ret[0]['issued-id'])) { if(strlen($ret[0]['issued-id'])) {
notice( t('You have already introduced yourself here.') . EOL ); notice( t('You have already introduced yourself here.') . EOL );
return; return;
@ -576,7 +576,7 @@ function dfrn_request_post(&$a) {
$parms['url'], $parms['url'],
$parms['issued-id'] $parms['issued-id']
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
update_contact_avatar($photo, $uid, $contact_record["id"], true); update_contact_avatar($photo, $uid, $contact_record["id"], true);
} }
@ -724,7 +724,7 @@ function dfrn_request_content(&$a) {
dbesc($_GET['confirm_key']) dbesc($_GET['confirm_key'])
); );
if(dbm::is_result($intro)) { if (dbm::is_result($intro)) {
$r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`id` = %d LIMIT 1", WHERE `contact`.`id` = %d LIMIT 1",
@ -733,7 +733,7 @@ function dfrn_request_content(&$a) {
$auto_confirm = false; $auto_confirm = false;
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP)) if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
$auto_confirm = true; $auto_confirm = true;

View File

@ -78,7 +78,7 @@ function directory_content(&$a) {
$r = $db->q("SELECT COUNT(*) AS `total` FROM `profile` $r = $db->q("SELECT COUNT(*) AS `total` FROM `profile`
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra "); WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$order = " ORDER BY `name` ASC "; $order = " ORDER BY `name` ASC ";
@ -90,7 +90,7 @@ function directory_content(&$a) {
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit); WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 AND `contact`.`self` $sql_extra $order LIMIT ".$limit);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(in_array('small', $a->argv)) if(in_array('small', $a->argv))
$photo = 'thumb'; $photo = 'thumb';

View File

@ -303,7 +303,7 @@ function display_content(&$a, $update = 0) {
intval($contact_id), intval($contact_id),
intval($a->profile['uid']) intval($a->profile['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -319,7 +319,7 @@ function display_content(&$a, $update = 0) {
$r = qu("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", $r = qu("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
intval($a->profile['uid']) intval($a->profile['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->page_contact = $r[0]; $a->page_contact = $r[0];
} }
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);

View File

@ -78,7 +78,7 @@ function editpost_content(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$mail_enabled = true; $mail_enabled = true;
if(intval($r[0]['pubmail'])) if(intval($r[0]['pubmail']))
$pubmail_enabled = true; $pubmail_enabled = true;

View File

@ -332,7 +332,7 @@ function events_content(&$a) {
$links = array(); $links = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$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'));
@ -344,7 +344,7 @@ function events_content(&$a) {
$events=array(); $events=array();
// transform the event in a usable array // transform the event in a usable array
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$r = sort_by_date($r); $r = sort_by_date($r);
$events = process_events($r); $events = process_events($r);
} }
@ -404,7 +404,7 @@ function events_content(&$a) {
intval($event_id), intval($event_id),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$orig_event = $r[0]; $orig_event = $r[0];
} }

View File

@ -24,7 +24,7 @@ function friendica_init(&$a) {
$visible_plugins = array(); $visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) { if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0"); $r = q("select * from addon where hidden = 0");
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$visible_plugins[] = $rr['name']; $visible_plugins[] = $rr['name'];
} }
@ -80,7 +80,7 @@ function friendica_content(&$a) {
$visible_plugins = array(); $visible_plugins = array();
if(is_array($a->plugins) && count($a->plugins)) { if(is_array($a->plugins) && count($a->plugins)) {
$r = q("select * from addon where hidden = 0"); $r = q("select * from addon where hidden = 0");
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$visible_plugins[] = $rr['name']; $visible_plugins[] = $rr['name'];
} }

View File

@ -33,7 +33,7 @@ function fsuggest_post(&$a) {
intval($new_contact), intval($new_contact),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`) $x = q("INSERT INTO `fsuggest` ( `uid`,`cid`,`name`,`url`,`request`,`photo`,`note`,`created`)
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')", VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
@ -50,7 +50,7 @@ function fsuggest_post(&$a) {
dbesc($hash), dbesc($hash),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$fsuggest_id = $r[0]['id']; $fsuggest_id = $r[0]['id'];
q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d", q("UPDATE `fsuggest` SET `note` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($note), dbesc($note),

View File

@ -107,7 +107,7 @@ function group_content(&$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))
$result = group_rmv(local_user(),$r[0]['name']); $result = group_rmv(local_user(),$r[0]['name']);
if($result) if($result)
info( t('Group removed.') . EOL); info( t('Group removed.') . EOL);
@ -125,7 +125,7 @@ function group_content(&$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))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }
@ -209,7 +209,7 @@ function group_content(&$a) {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) { foreach($r as $member) {
if(! in_array($member['id'],$preselected)) { if(! in_array($member['id'],$preselected)) {

View File

@ -165,7 +165,7 @@ function install_content(&$a) {
if($db && $db->connected) { if($db && $db->connected) {
$r = q("SELECT COUNT(*) as `total` FROM `user`"); $r = q("SELECT COUNT(*) as `total` FROM `user`");
if(dbm::is_result($r) && $r[0]['total']) { if (dbm::is_result($r) && $r[0]['total']) {
$tpl = get_markup_template('install.tpl'); $tpl = get_markup_template('install.tpl');
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$title' => $install_title, '$title' => $install_title,

View File

@ -102,7 +102,7 @@ function item_post(&$a) {
} }
// if this isn't the real parent of the conversation, find it // if this isn't the real parent of the conversation, find it
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$parid = $r[0]['parent']; $parid = $r[0]['parent'];
$parent_uri = $r[0]['uri']; $parent_uri = $r[0]['uri'];
if($r[0]['id'] != $r[0]['parent']) { if($r[0]['id'] != $r[0]['parent']) {
@ -130,7 +130,7 @@ function item_post(&$a) {
intval($parent_item['contact-id']), intval($parent_item['contact-id']),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$parent_contact = $r[0]; $parent_contact = $r[0];
// If the contact id doesn't fit with the contact, then set the contact to null // If the contact id doesn't fit with the contact, then set the contact to null
@ -234,7 +234,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$user = $r[0]; $user = $r[0];
if($orig_post) { if($orig_post) {
@ -330,7 +330,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r) && intval($r[0]['pubmail'])) if (dbm::is_result($r) && intval($r[0]['pubmail']))
$pubmail_enabled = true; $pubmail_enabled = true;
} }
} }
@ -399,7 +399,7 @@ function item_post(&$a) {
} }
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$author = $r[0]; $author = $r[0];
$contact_id = $author['id']; $contact_id = $author['id'];
} }
@ -413,7 +413,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid) intval($profile_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$contact_record = $r[0]; $contact_record = $r[0];
} }
@ -496,7 +496,7 @@ function item_post(&$a) {
intval($profile_uid), intval($profile_uid),
intval($attach) intval($attach)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `uid` = %d AND `id` = %d", WHERE `uid` = %d AND `id` = %d",
dbesc($str_contact_allow), dbesc($str_contact_allow),
@ -637,7 +637,7 @@ function item_post(&$a) {
intval($profile_uid), intval($profile_uid),
intval($mtch) intval($mtch)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(strlen($attachments)) if(strlen($attachments))
$attachments .= ','; $attachments .= ',';
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]'; $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';

View File

@ -52,7 +52,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $allowed_groups)) dbesc(implode(', ', $allowed_groups))
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b>' . $rr['name'] . '</b>'; $l[] = '<b>' . $rr['name'] . '</b>';
} }
@ -60,7 +60,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$allowed_users)) dbesc(implode(', ',$allowed_users))
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = $rr['name']; $l[] = $rr['name'];
@ -70,7 +70,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
dbesc(implode(', ', $deny_groups)) dbesc(implode(', ', $deny_groups))
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>'; $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
} }
@ -78,7 +78,7 @@ function lockview_content(&$a) {
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
dbesc(implode(', ',$deny_users)) dbesc(implode(', ',$deny_users))
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$l[] = '<strike>' . $rr['name'] . '</strike>'; $l[] = '<strike>' . $rr['name'] . '</strike>';

View File

@ -15,7 +15,7 @@ function manage_post(&$a) {
$r = q("select * from user where uid = %d limit 1", $r = q("select * from user where uid = %d limit 1",
intval($_SESSION['submanage']) intval($_SESSION['submanage'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$uid = intval($r[0]['uid']); $uid = intval($r[0]['uid']);
$orig_record = $r[0]; $orig_record = $r[0];
} }

View File

@ -242,7 +242,7 @@ function message_content(&$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)) {
$parent = $r[0]['parent-uri']; $parent = $r[0]['parent-uri'];
$convid = $r[0]['convid']; $convid = $r[0]['convid'];
@ -309,21 +309,21 @@ function message_content(&$a) {
intval(local_user()), intval(local_user()),
intval($a->argv[2]) intval($a->argv[2])
); );
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1", $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc(normalise_link(base64_decode($a->argv[2]))) dbesc(normalise_link(base64_decode($a->argv[2])))
); );
} }
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1", $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc(base64_decode($a->argv[2])) dbesc(base64_decode($a->argv[2]))
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$prename = $r[0]['name']; $prename = $r[0]['name'];
$preurl = $r[0]['url']; $preurl = $r[0]['url'];
$preid = $r[0]['id']; $preid = $r[0]['id'];
@ -407,7 +407,7 @@ function message_content(&$a) {
intval(local_user()), intval(local_user()),
intval($a->argv[1]) intval($a->argv[1])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
$convid = $r[0]['convid']; $convid = $r[0]['convid'];

View File

@ -36,7 +36,7 @@ function mood_init(&$a) {
intval($parent), intval($parent),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$parent_uri = $r[0]['uri']; $parent_uri = $r[0]['uri'];
$private = $r[0]['private']; $private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid']; $allow_cid = $r[0]['allow_cid'];

View File

@ -14,7 +14,7 @@ function msearch_post(&$a) {
dbesc($search) dbesc($search)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$total = $r[0]['total']; $total = $r[0]['total'];
$results = array(); $results = array();
@ -25,7 +25,7 @@ function msearch_post(&$a) {
intval($perpage) intval($perpage)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( $results[] = array(
'name' => $rr['name'], 'name' => $rr['name'],

View File

@ -182,7 +182,7 @@ function saved_searches($search) {
$saved = array(); $saved = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$saved[] = array( $saved[] = array(
'id' => $rr['id'], 'id' => $rr['id'],
@ -381,7 +381,7 @@ function network_content(&$a, $update = 0) {
); );
$str = ''; $str = '';
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$str .= '<' . $rr['id'] . '>'; $str .= '<' . $rr['id'] . '>';
if(strlen($str)) if(strlen($str))
@ -507,7 +507,7 @@ function network_content(&$a, $update = 0) {
AND (NOT `blocked` OR `pending`) LIMIT 1", AND (NOT `blocked` OR `pending`) LIMIT 1",
intval($cid) intval($cid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid); $sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid);
$entries[0] = array( $entries[0] = array(
@ -609,7 +609,7 @@ function network_content(&$a, $update = 0) {
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
} }
@ -705,7 +705,7 @@ function network_content(&$a, $update = 0) {
$parents_str = ''; $parents_str = '';
$date_offset = ""; $date_offset = "";
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
if(! in_array($rr['item_id'],$parents_arr)) if(! in_array($rr['item_id'],$parents_arr))
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];

View File

@ -28,11 +28,11 @@ function nogroup_content(&$a) {
require_once('include/Contact.php'); require_once('include/Contact.php');
$r = contacts_not_grouped(local_user()); $r = contacts_not_grouped(local_user());
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
$r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']); $r = contacts_not_grouped(local_user(),$a->pager['start'],$a->pager['itemspage']);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$contact_details = get_contact_details_by_url($rr['url'], local_user(), $rr); $contact_details = get_contact_details_by_url($rr['url'], local_user(), $rr);

View File

@ -43,7 +43,7 @@ function noscrape_init(&$a) {
if(is_array($a->profile) AND !$a->profile['hide-friends']) { if(is_array($a->profile) AND !$a->profile['hide-friends']) {
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1", $r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
intval($a->profile['uid'])); intval($a->profile['uid']));
if(dbm::is_result($r)) if (dbm::is_result($r))
$json_info["updated"] = date("c", strtotime($r[0]['updated'])); $json_info["updated"] = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0
@ -53,7 +53,7 @@ function noscrape_init(&$a) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$json_info["contacts"] = intval($r[0]['total']); $json_info["contacts"] = intval($r[0]['total']);
} }

View File

@ -82,7 +82,7 @@ function notes_content(&$a,$update = false) {
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(40); $a->set_pager_itemspage(40);
} }
@ -102,7 +102,7 @@ function notes_content(&$a,$update = false) {
$parents_arr = array(); $parents_arr = array();
$parents_str = ''; $parents_str = '';
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$parents_arr[] = $rr['item_id']; $parents_arr[] = $rr['item_id'];
$parents_str = implode(', ', $parents_arr); $parents_str = implode(', ', $parents_arr);
@ -116,7 +116,7 @@ function notes_content(&$a,$update = false) {
dbesc($parents_str) dbesc($parents_str)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$items = conv_sort($r,"`commented`"); $items = conv_sort($r,"`commented`");
$o .= conversation($a,$items,'notes',$update); $o .= conversation($a,$items,'notes',$update);

View File

@ -27,7 +27,7 @@ function notifications_post(&$a) {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$intro_id = $r[0]['id']; $intro_id = $r[0]['id'];
$contact_id = $r[0]['contact-id']; $contact_id = $r[0]['contact-id'];
} }

View File

@ -38,7 +38,7 @@ function openid_content(&$a) {
dbesc($authid), dbesc(normalise_openid($authid)) dbesc($authid), dbesc(normalise_openid($authid))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
// successful OpenID login // successful OpenID login

View File

@ -76,7 +76,7 @@ function photo_init(&$a) {
intval($resolution), intval($resolution),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$data = $r[0]['data']; $data = $r[0]['data'];
$mimetype = $r[0]['type']; $mimetype = $r[0]['type'];
} }
@ -106,7 +106,7 @@ function photo_init(&$a) {
dbesc($photo), dbesc($photo),
intval($resolution) intval($resolution)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$sql_extra = permissions_sql($r[0]['uid']); $sql_extra = permissions_sql($r[0]['uid']);
@ -119,7 +119,7 @@ function photo_init(&$a) {
$public = (dbm::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == ''); $public = (dbm::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$resolution = $r[0]['scale']; $resolution = $r[0]['scale'];
$data = $r[0]['data']; $data = $r[0]['data'];
$mimetype = $r[0]['type']; $mimetype = $r[0]['type'];

View File

@ -254,7 +254,7 @@ function photos_post(&$a) {
dbesc($album) dbesc($album)
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$res[] = "'" . dbesc($rr['rid']) . "'" ; $res[] = "'" . dbesc($rr['rid']) . "'" ;
} }
@ -276,7 +276,7 @@ function photos_post(&$a) {
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", $r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid) intval($page_owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()), dbesc(datetime_convert()),
@ -337,7 +337,7 @@ function photos_post(&$a) {
dbesc($a->argv[2]) dbesc($a->argv[2])
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
intval($page_owner_uid), intval($page_owner_uid),
dbesc($r[0]['resource-id']) dbesc($r[0]['resource-id'])
@ -393,7 +393,7 @@ function photos_post(&$a) {
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$ph = new Photo($r[0]['data'], $r[0]['type']); $ph = new Photo($r[0]['data'], $r[0]['type']);
if ($ph->is_valid()) { if ($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 ); $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
@ -510,7 +510,7 @@ function photos_post(&$a) {
intval($page_owner_uid) intval($page_owner_uid)
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$old_tag = $r[0]['tag']; $old_tag = $r[0]['tag'];
$old_inform = $r[0]['inform']; $old_inform = $r[0]['inform'];
} }
@ -594,7 +594,7 @@ function photos_post(&$a) {
intval($page_owner_uid) intval($page_owner_uid)
); );
}*/ }*/
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$newname = $r[0]['name']; $newname = $r[0]['name'];
$profile = $r[0]['url']; $profile = $r[0]['url'];
$notify = 'cid:' . $r[0]['id']; $notify = 'cid:' . $r[0]['id'];
@ -1008,7 +1008,7 @@ function photos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$can_post = true; $can_post = true;
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
@ -1036,7 +1036,7 @@ function photos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -1188,7 +1188,7 @@ function photos_content(&$a) {
intval($owner_uid), intval($owner_uid),
dbesc($album) dbesc($album)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(count($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -1243,7 +1243,7 @@ function photos_content(&$a) {
$photos = array(); $photos = array();
if(dbm::is_result($r)) if (dbm::is_result($r))
$twist = 'rotright'; $twist = 'rotright';
foreach ($r as $rr) { foreach ($r as $rr) {
if ($twist == 'rotright') if ($twist == 'rotright')
@ -1435,7 +1435,7 @@ function photos_content(&$a) {
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
@ -1611,7 +1611,7 @@ function photos_content(&$a) {
// display comments // display comments
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $item) { foreach ($r as $item) {
builtin_activity_puller($item, $conv_responses); builtin_activity_puller($item, $conv_responses);
@ -1794,7 +1794,7 @@ function photos_content(&$a) {
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc( t('Contact Photos')) dbesc( t('Contact Photos'))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(count($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -1809,10 +1809,8 @@ function photos_content(&$a) {
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
$photos = array(); $photos = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$twist = 'rotright'; $twist = 'rotright';
foreach ($r as $rr) { foreach ($r as $rr) {
//hide profile photos to others //hide profile photos to others

View File

@ -83,7 +83,7 @@ function poco_init(&$a) {
dbesc(NETWORK_STATUSNET) dbesc(NETWORK_STATUSNET)
); );
} }
if(dbm::is_result($r)) if (dbm::is_result($r))
$totalResults = intval($r[0]['total']); $totalResults = intval($r[0]['total']);
else else
$totalResults = 0; $totalResults = 0;
@ -173,7 +173,7 @@ function poco_init(&$a) {
} }
if(is_array($r)) { if(is_array($r)) {
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if (!isset($rr['generation'])) { if (!isset($rr['generation'])) {
if ($global) if ($global)

View File

@ -66,7 +66,7 @@ function poke_init(&$a) {
intval($parent), intval($parent),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$parent_uri = $r[0]['uri']; $parent_uri = $r[0]['uri'];
$private = $r[0]['private']; $private = $r[0]['private'];
$allow_cid = $r[0]['allow_cid']; $allow_cid = $r[0]['allow_cid'];
@ -159,7 +159,7 @@ function poke_content(&$a) {
intval($_GET['c']), intval($_GET['c']),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$name = $r[0]['name']; $name = $r[0]['name'];
$id = $r[0]['id']; $id = $r[0]['id'];
} }

View File

@ -13,7 +13,7 @@ function profile_init(&$a) {
$which = htmlspecialchars($a->argv[1]); $which = htmlspecialchars($a->argv[1]);
else { else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1"); $r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']); goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
} }
else { else {
@ -136,7 +136,7 @@ function profile_content(&$a, $update = 0) {
intval($contact_id), intval($contact_id),
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -258,7 +258,7 @@ function profile_content(&$a, $update = 0) {
intval($a->profile['profile_uid']) intval($a->profile['profile_uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
} }
} }

View File

@ -32,7 +32,7 @@ function profile_photo_post(&$a) {
intval($_REQUEST['profile']), intval($_REQUEST['profile']),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r) && (! intval($r[0]['is-default']))) if (dbm::is_result($r) && (! intval($r[0]['is-default'])))
$is_default_profile = 0; $is_default_profile = 0;
} }
@ -63,7 +63,7 @@ function profile_photo_post(&$a) {
dbesc(local_user()), dbesc(local_user()),
intval($scale)); intval($scale));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$base_image = $r[0]; $base_image = $r[0];

View File

@ -286,7 +286,7 @@ function profiles_post(&$a) {
intval(local_user()) intval(local_user())
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$prf = $r[0]['url']; $prf = $r[0]['url'];
$newname = $r[0]['name']; $newname = $r[0]['name'];
} }
@ -767,7 +767,7 @@ function profiles_content(&$a) {
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1", "SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user() local_user()
); );
if(dbm::is_result($r)){ if (dbm::is_result($r)){
//Go to the default profile. //Go to the default profile.
goaway('profiles/'.$r[0]['id']); goaway('profiles/'.$r[0]['id']);
} }
@ -775,7 +775,7 @@ function profiles_content(&$a) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d", $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user()); local_user());
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$tpl = get_markup_template('profile_entry.tpl'); $tpl = get_markup_template('profile_entry.tpl');
foreach($r as $rr) { foreach($r as $rr) {

View File

@ -42,7 +42,7 @@ function profperm_content(&$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))
$change = intval($a->argv[2]); $change = intval($a->argv[2]);
} }
@ -64,7 +64,7 @@ function profperm_content(&$a) {
); );
$ingroup = array(); $ingroup = array();
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $member) foreach($r as $member)
$ingroup[] = $member['id']; $ingroup[] = $member['id'];
@ -94,7 +94,7 @@ function profperm_content(&$a) {
$members = $r; $members = $r;
$ingroup = array(); $ingroup = array();
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $member) foreach($r as $member)
$ingroup[] = $member['id']; $ingroup[] = $member['id'];
} }
@ -138,7 +138,7 @@ function profperm_content(&$a) {
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false); $textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) { foreach($r as $member) {
if(! in_array($member['id'],$ingroup)) { if(! in_array($member['id'],$ingroup)) {

View File

@ -55,7 +55,7 @@ function pubsubhubbub_init(&$a) {
" AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", " 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('pubsubhubbub: local account not found: ' . $nick); logger('pubsubhubbub: local account not found: ' . $nick);
http_status_exit(404); http_status_exit(404);
} }
@ -73,7 +73,7 @@ function pubsubhubbub_init(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`". $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`".
" AND NOT `pending` AND `self` LIMIT 1", " AND NOT `pending` AND `self` LIMIT 1",
intval($owner['uid'])); intval($owner['uid']));
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
logger('pubsubhubbub: contact not found.'); logger('pubsubhubbub: contact not found.');
http_status_exit(404); http_status_exit(404);
} }

View File

@ -23,7 +23,7 @@ function qsearch_init(&$a) {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( 0, (int) $rr['id'], $rr['name'], '', ''); $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
@ -38,7 +38,7 @@ function qsearch_init(&$a) {
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']); $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);

View File

@ -34,7 +34,7 @@ function user_allow($hash) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1", $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
intval($user[0]['uid']) intval($user[0]['uid'])
); );
if(dbm::is_result($r) && $r[0]['net-publish']) { if (dbm::is_result($r) && $r[0]['net-publish']) {
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname']; $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
if($url && strlen(get_config('system','directory'))) if($url && strlen(get_config('system','directory')))
proc_run(PRIORITY_LOW, "include/directory.php", $url); proc_run(PRIORITY_LOW, "include/directory.php", $url);

View File

@ -170,7 +170,7 @@ function salmon_post(&$a) {
// If so we can not accept this post. // If so we can not accept this post.
//if((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) { //if((dbm::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
if(dbm::is_result($r) && $r[0]['blocked']) { if (dbm::is_result($r) && $r[0]['blocked']) {
logger('mod-salmon: Ignoring this author.'); logger('mod-salmon: Ignoring this author.');
http_status_exit(202); http_status_exit(202);
// NOTREACHED // NOTREACHED

View File

@ -15,7 +15,7 @@ function search_saved_searches() {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$saved = array(); $saved = array();
foreach($r as $rr) { foreach($r as $rr) {
$saved[] = array( $saved[] = array(

View File

@ -255,7 +255,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)) {
$eacct = $r[0]; $eacct = $r[0];
require_once('include/email.php'); require_once('include/email.php');
$mb = construct_mailbox_name($eacct); $mb = construct_mailbox_name($eacct);

View File

@ -53,7 +53,7 @@ function subthread_content(&$a) {
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1", WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$owner = $r[0]; $owner = $r[0];
if(! $owner) { if(! $owner) {
@ -75,7 +75,7 @@ function subthread_content(&$a) {
intval($_SESSION['visitor_id']), intval($_SESSION['visitor_id']),
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$contact = $r[0]; $contact = $r[0];
} }
if(! $contact) { if(! $contact) {

View File

@ -39,7 +39,7 @@ function tagger_content(&$a) {
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1", $r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$owner_nick = $r[0]['nickname']; $owner_nick = $r[0]['nickname'];
$blocktags = $r[0]['blocktags']; $blocktags = $r[0]['blocktags'];
} }
@ -50,7 +50,7 @@ function tagger_content(&$a) {
$r = q("select * from contact where self = 1 and uid = %d limit 1", $r = q("select * from contact where self = 1 and uid = %d limit 1",
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$contact = $r[0]; $contact = $r[0];
else { else {
logger('tagger: no contact_id'); logger('tagger: no contact_id');
@ -178,7 +178,7 @@ EOT;
$r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1", $r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
dbesc($item['uri']) dbesc($item['uri'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1", $x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
intval($r[0]['uid']) intval($r[0]['uid'])
); );

View File

@ -44,7 +44,7 @@ function uexport_content(&$a){
function _uexport_multirow($query) { function _uexport_multirow($query) {
$result = array(); $result = array();
$r = q($query); $r = q($query);
// if(dbm::is_result($r)) { // if (dbm::is_result($r)) {
if ($r){ if ($r){
foreach($r as $rr){ foreach($r as $rr){
$p = array(); $p = array();
@ -130,7 +130,7 @@ function uexport_all(&$a) {
$r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ", $r = q("SELECT count(*) as `total` FROM `item` WHERE `uid` = %d ",
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$total = $r[0]['total']; $total = $r[0]['total'];
// chunk the output to avoid exhausting memory // chunk the output to avoid exhausting memory
@ -142,7 +142,7 @@ function uexport_all(&$a) {
intval($x), intval($x),
intval(500) intval(500)
); );
/*if(dbm::is_result($r)) { /*if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
foreach($rr as $k => $v) foreach($rr as $k => $v)
$item[][$k] = $v; $item[][$k] = $v;

View File

@ -140,7 +140,7 @@ function videos_post(&$a) {
dbesc($video_id) dbesc($video_id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'", q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
intval(local_user()), intval(local_user()),
dbesc($video_id) dbesc($video_id)
@ -259,7 +259,7 @@ function videos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$can_post = true; $can_post = true;
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
@ -287,7 +287,7 @@ function videos_content(&$a) {
intval($contact_id), intval($contact_id),
intval($owner_uid) intval($owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact = $r[0]; $contact = $r[0];
$remote_contact = true; $remote_contact = true;
} }
@ -347,7 +347,7 @@ function videos_content(&$a) {
$sql_extra GROUP BY hash", $sql_extra GROUP BY hash",
intval($a->data['user']['uid']) intval($a->data['user']['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->set_pager_total(count($r)); $a->set_pager_total(count($r));
$a->set_pager_itemspage(20); $a->set_pager_itemspage(20);
} }
@ -363,7 +363,7 @@ function videos_content(&$a) {
$videos = array(); $videos = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if($a->theme['template_engine'] === 'internal') { if($a->theme['template_engine'] === 'internal') {
$alt_e = template_escape($rr['filename']); $alt_e = template_escape($rr['filename']);

View File

@ -54,7 +54,7 @@ function viewcontacts_content(&$a) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->set_pager_total($r[0]['total']); $a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact` $r = q("SELECT * FROM `contact`
@ -68,7 +68,7 @@ function viewcontacts_content(&$a) {
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
info(t('No contacts.').EOL); info(t('No contacts.').EOL);
return $o; return $o;
} }

View File

@ -24,7 +24,7 @@ function viewsrc_content(&$a) {
dbesc($item_id) dbesc($item_id)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
if(is_ajax()) { if(is_ajax()) {
echo str_replace("\n",'<br />',$r[0]['body']); echo str_replace("\n",'<br />',$r[0]['body']);
killme(); killme();

View File

@ -55,7 +55,7 @@ function wall_attach_post(&$a) {
intval($contact_id), intval($contact_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$can_post = true; $can_post = true;
$visitor = $contact_id; $visitor = $contact_id;
} }

View File

@ -63,7 +63,7 @@ function wall_upload_post(&$a, $desktopmode = true) {
intval($contact_id), intval($contact_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$can_post = true; $can_post = true;
$visitor = $contact_id; $visitor = $contact_id;
} }