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:42:36 +01:00
parent 448c5aa694
commit a905522eb5
36 changed files with 143 additions and 143 deletions

View file

@ -435,7 +435,7 @@ function random_profile() {
ORDER BY rand() LIMIT 1", ORDER BY rand() LIMIT 1",
dbesc(NETWORK_DFRN)); dbesc(NETWORK_DFRN));
if(dbm::is_result($r)) if (dbm::is_result($r))
return dirname($r[0]['url']); return dirname($r[0]['url']);
return ''; return '';
} }

View file

@ -88,7 +88,7 @@ class ForumManager {
$total = count($contacts); $total = count($contacts);
$visible_forums = 10; $visible_forums = 10;
if(dbm::is_result($contacts)) { if (dbm::is_result($contacts)) {
$id = 0; $id = 0;

View file

@ -88,7 +88,7 @@ class NotificationsManager {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $this->_set_extra($r); return $this->_set_extra($r);
return false; return false;
@ -105,7 +105,7 @@ class NotificationsManager {
intval($id), intval($id),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
return $this->_set_extra($r)[0]; return $this->_set_extra($r)[0];
} }
return null; return null;
@ -358,7 +358,7 @@ class NotificationsManager {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -401,7 +401,7 @@ class NotificationsManager {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$notifs = $this->formatNotifs($r, $ident); $notifs = $this->formatNotifs($r, $ident);
$arr = array ( $arr = array (
@ -430,7 +430,7 @@ class NotificationsManager {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -466,7 +466,7 @@ class NotificationsManager {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$notifs = $this->formatNotifs($r, $ident); $notifs = $this->formatNotifs($r, $ident);
$arr = array ( $arr = array (
@ -520,7 +520,7 @@ class NotificationsManager {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -564,7 +564,7 @@ class NotificationsManager {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$notifs = $this->formatNotifs($r, $ident); $notifs = $this->formatNotifs($r, $ident);
$arr = array ( $arr = array (
@ -596,7 +596,7 @@ class NotificationsManager {
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -638,7 +638,7 @@ class NotificationsManager {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$notifs = $this->formatNotifs($r, $ident); $notifs = $this->formatNotifs($r, $ident);
$arr = array ( $arr = array (
@ -668,7 +668,7 @@ class NotificationsManager {
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -713,7 +713,7 @@ class NotificationsManager {
intval($limit) intval($limit)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$notifs = $this->formatIntros($r); $notifs = $this->formatIntros($r);
$arr = array ( $arr = array (

View file

@ -1084,7 +1084,7 @@ class Probe {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid)); $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
if(dbm::is_result($x) && dbm::is_result($r)) { if (dbm::is_result($x) && dbm::is_result($r)) {
$mailbox = construct_mailbox_name($r[0]); $mailbox = construct_mailbox_name($r[0]);
$password = ''; $password = '';
openssl_private_decrypt(hex2bin($r[0]['pass']), $password,$x[0]['prvkey']); openssl_private_decrypt(hex2bin($r[0]['pass']), $password,$x[0]['prvkey']);

View file

@ -33,7 +33,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
call_hooks($a->module . '_pre_' . $selname, $arr); call_hooks($a->module . '_pre_' . $selname, $arr);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -144,7 +144,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
call_hooks($a->module . '_pre_' . $selname, $arr); call_hooks($a->module . '_pre_' . $selname, $arr);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -220,7 +220,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$receiverlist = array(); $receiverlist = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected)) if((is_array($preselected)) && in_array($rr['id'], $preselected))
$selected = " selected=\"selected\" "; $selected = " selected=\"selected\" ";
@ -314,7 +314,7 @@ function populate_acl($user = null, $show_jotnets = false) {
$r = q("SELECT `pubmail` FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", $r = q("SELECT `pubmail` 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;
@ -577,7 +577,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$r = array(); $r = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $g){ foreach($r as $g){
$contacts[] = array( $contacts[] = array(
"type" => "c", "type" => "c",

View file

@ -208,7 +208,7 @@
dbesc(trim($user)), dbesc(trim($user)),
dbesc($encrypted) dbesc($encrypted)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$record = $r[0]; $record = $r[0];
} }
@ -2755,7 +2755,7 @@
intval(api_user()) intval(api_user())
); );
if(!dbm::is_result($r)) if (!dbm::is_result($r))
return; return;
$ids = array(); $ids = array();

View file

@ -12,7 +12,7 @@ function contact_profile_assign($current,$foreign_net) {
$r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d", $r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($rr['id'] == $current) ? " selected=\"selected\" " : ""); $selected = (($rr['id'] == $current) ? " selected=\"selected\" " : "");
$o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n"; $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";

View file

@ -93,7 +93,7 @@ function networks_widget($baseurl,$selected = '') {
); );
$nets = array(); $nets = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
foreach($r as $rr) { foreach($r as $rr) {
if($rr['network']) if($rr['network'])
@ -204,13 +204,13 @@ function common_friends_visitor_widget($profile_uid) {
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

@ -109,7 +109,7 @@ function localize_item(&$item){
$r = q("SELECT * from `item`,`contact` WHERE $r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';", `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
dbesc($item['parent-uri'])); dbesc($item['parent-uri']));
if(!dbm::is_result($r)) return; if (!dbm::is_result($r)) return;
$obj=$r[0]; $obj=$r[0];
$author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
@ -245,7 +245,7 @@ function localize_item(&$item){
$r = q("SELECT * from `item`,`contact` WHERE $r = q("SELECT * from `item`,`contact` WHERE
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';", `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
dbesc($item['parent-uri'])); dbesc($item['parent-uri']));
if(!dbm::is_result($r)) return; if (!dbm::is_result($r)) return;
$obj=$r[0]; $obj=$r[0];
$author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]'; $author = '[url=' . zrl($item['author-link']) . ']' . $item['author-name'] . '[/url]';
@ -294,7 +294,7 @@ function localize_item(&$item){
dbesc($obj->id), dbesc($obj->id),
intval($item['uid']) intval($item['uid'])
); );
if(dbm::is_result($r) && $r[0]['plink']) { if (dbm::is_result($r) && $r[0]['plink']) {
$target = $r[0]; $target = $r[0];
$Bname = $target['author-name']; $Bname = $target['author-name'];
$Blink = $target['author-link']; $Blink = $target['author-link'];

View file

@ -552,7 +552,7 @@ function update_contact_birthdays() {
// In-network birthdays are handled within local_delivery // In-network birthdays are handled within local_delivery
$r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` "); $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']); logger('update_contact_birthday: ' . $rr['bd']);

View file

@ -188,7 +188,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
$sql3=""; $sql3="";
if (!isset($database[$name])) { if (!isset($database[$name])) {
$r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']); $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
$errors .= t('Errors encountered creating database tables.').$name.EOL; $errors .= t('Errors encountered creating database tables.').$name.EOL;
} }
$is_new_table = True; $is_new_table = True;
@ -265,7 +265,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
if ($action) { if ($action) {
$r = @$db->q($sql3); $r = @$db->q($sql3);
if(dbm::is_result($r)) if (dbm::is_result($r))
$errors .= t('Errors encountered performing database changes.').$sql3.EOL; $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
} }
} }

View file

@ -1463,7 +1463,7 @@ class dfrn {
dbesc(normalise_link($suggest["url"])), dbesc(normalise_link($suggest["url"])),
intval($suggest["uid"]) intval($suggest["uid"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return false; return false;
// Do we already have an fcontact record for this person? // Do we already have an fcontact record for this person?
@ -1474,7 +1474,7 @@ class dfrn {
dbesc($suggest["name"]), dbesc($suggest["name"]),
dbesc($suggest["request"]) dbesc($suggest["request"])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$fid = $r[0]["id"]; $fid = $r[0]["id"];
// OK, we do. Do we already have an introduction for this person ? // OK, we do. Do we already have an introduction for this person ?
@ -1482,7 +1482,7 @@ class dfrn {
intval($suggest["uid"]), intval($suggest["uid"]),
intval($fid) intval($fid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return false; return false;
} }
if(!$fid) if(!$fid)
@ -1497,7 +1497,7 @@ class dfrn {
dbesc($suggest["name"]), dbesc($suggest["name"]),
dbesc($suggest["request"]) dbesc($suggest["request"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$fid = $r[0]["id"]; $fid = $r[0]["id"];
else else
// database record did not get created. Quietly give up. // database record did not get created. Quietly give up.
@ -1746,7 +1746,7 @@ class dfrn {
LIMIT 1", LIMIT 1",
dbesc($item["parent-uri"]) dbesc($item["parent-uri"])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$r = q("SELECT `item`.`forum_mode`, `item`.`wall` FROM `item` $r = q("SELECT `item`.`forum_mode`, `item`.`wall` FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' OR `item`.`thr-parent` = '%s') WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' OR `item`.`thr-parent` = '%s')
@ -1758,7 +1758,7 @@ class dfrn {
dbesc($r[0]["parent-uri"]), dbesc($r[0]["parent-uri"]),
intval($importer["importer_uid"]) intval($importer["importer_uid"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$is_a_remote_action = true; $is_a_remote_action = true;
} }
@ -1898,7 +1898,7 @@ class dfrn {
dbesc($item["verb"]), dbesc($item["verb"]),
dbesc($item["parent-uri"]) dbesc($item["parent-uri"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return false; return false;
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1",
@ -1907,7 +1907,7 @@ class dfrn {
dbesc($item["verb"]), dbesc($item["verb"]),
dbesc($item["parent-uri"]) dbesc($item["parent-uri"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return false; return false;
} else } else
$is_like = false; $is_like = false;
@ -1923,7 +1923,7 @@ class dfrn {
intval($importer["importer_uid"]) intval($importer["importer_uid"])
); );
if(!dbm::is_result($r)) if (!dbm::is_result($r))
return false; return false;
// extract tag, if not duplicate, add to parent item // extract tag, if not duplicate, add to parent item
@ -2195,7 +2195,7 @@ class dfrn {
dbesc($item["uri"]), dbesc($item["uri"]),
intval($importer["uid"]) intval($importer["uid"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$ev["id"] = $r[0]["id"]; $ev["id"] = $r[0]["id"];
$event_id = event_store($ev); $event_id = event_store($ev);
@ -2216,7 +2216,7 @@ class dfrn {
} }
// Update content if 'updated' changes // Update content if 'updated' changes
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if (self::update_content($r[0], $item, $importer, $entrytype)) if (self::update_content($r[0], $item, $importer, $entrytype))
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG); logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
else else
@ -2238,7 +2238,7 @@ class dfrn {
intval($posted_id), intval($posted_id),
intval($importer["importer_uid"]) intval($importer["importer_uid"])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$parent = $r[0]["parent"]; $parent = $r[0]["parent"];
$parent_uri = $r[0]["parent-uri"]; $parent_uri = $r[0]["parent-uri"];
} }
@ -2326,7 +2326,7 @@ class dfrn {
intval($importer["uid"]), intval($importer["uid"]),
intval($importer["id"]) intval($importer["id"])
); );
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
logger("Item with uri ".$uri." from contact ".$importer["id"]." for user ".$importer["uid"]." wasn't found.", LOGGER_DEBUG); logger("Item with uri ".$uri." from contact ".$importer["id"]." for user ".$importer["uid"]." wasn't found.", LOGGER_DEBUG);
return; return;
} else { } else {
@ -2420,7 +2420,7 @@ class dfrn {
dbesc($item["parent-uri"]), dbesc($item["parent-uri"]),
intval($importer["uid"]) intval($importer["uid"])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d", q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]["id"]) intval($r[0]["id"])
); );

View file

@ -1278,7 +1278,7 @@ class diaspora {
$r = q("SELECT `id` FROM `mail` WHERE `uri` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `mail` WHERE `uri` = '%s' LIMIT 1",
dbesc($message_uri) dbesc($message_uri)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG); logger("duplicate message already delivered.", LOGGER_DEBUG);
return false; return false;
} }
@ -2925,7 +2925,7 @@ class diaspora {
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1", $p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($item["thr-parent"])); dbesc($item["thr-parent"]));
if(!dbm::is_result($p)) if (!dbm::is_result($p))
return false; return false;
$parent = $p[0]; $parent = $p[0];

View file

@ -411,7 +411,7 @@ function notification($params) {
$hash = random_string(); $hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash)); dbesc($hash));
if(dbm::is_result($r)) if (dbm::is_result($r))
$dups = true; $dups = true;
} while($dups == true); } while($dups == true);

View file

@ -312,7 +312,7 @@ function event_store($arr) {
intval($arr['id']), intval($arr['id']),
intval($arr['uid']) intval($arr['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>'; $object = '<object><type>' . xmlify(ACTIVITY_OBJ_EVENT) . '</type><title></title><id>' . xmlify($arr['uri']) . '</id>';
$object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>'; $object .= '<content>' . xmlify(format_event_bbcode($arr)) . '</content>';
$object .= '</object>' . "\n"; $object .= '</object>' . "\n";
@ -365,7 +365,7 @@ function event_store($arr) {
dbesc($arr['uri']), dbesc($arr['uri']),
intval($arr['uid']) intval($arr['uid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$event = $r[0]; $event = $r[0];
$item_arr = array(); $item_arr = array();
@ -407,7 +407,7 @@ function event_store($arr) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($arr['uid']) intval($arr['uid'])
); );
//if(dbm::is_result($r)) //if (dbm::is_result($r))
// $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; // $plink = $a->get_baseurl() . '/display/' . $r[0]['nickname'] . '/' . $item_id;
@ -515,7 +515,7 @@ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') {
intval($event_params["event_id"]) intval($event_params["event_id"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r; return $r;
} }
@ -557,7 +557,7 @@ function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') {
dbesc($event_params["adjust_finish"]) dbesc($event_params["adjust_finish"])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r; return $r;
} }
@ -750,7 +750,7 @@ function events_by_uid($uid = 0, $sql_extra = '') {
); );
} }
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r; return $r;
} }

View file

@ -39,7 +39,7 @@ function expire_run(&$argv, &$argc){
logger('expire: start'); logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0"); $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG); logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
item_expire($rr['uid'],$rr['expire']); item_expire($rr['uid'],$rr['expire']);

View file

@ -10,7 +10,7 @@ function fcontact_store($url,$name,$photo) {
dbesc($nurl) dbesc($nurl)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['id']; return $r[0]['id'];
$r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ", $r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
@ -19,11 +19,11 @@ function fcontact_store($url,$name,$photo) {
dbesc($photo) dbesc($photo)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
dbesc($nurl) dbesc($nurl)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['id']; return $r[0]['id'];
} }

View file

@ -173,12 +173,12 @@ function new_contact($uid,$url,$interactive = false) {
dbesc($ret['network']) dbesc($ret['network'])
); );
if(!dbm::is_result($r)) if (!dbm::is_result($r))
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' LIMIT 1",
intval($uid), dbesc(normalise_link($url)), dbesc($ret['network']) intval($uid), dbesc(normalise_link($url)), dbesc($ret['network'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
// update contact // update contact
if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d", q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
@ -196,7 +196,7 @@ function new_contact($uid,$url,$interactive = false) {
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0", $r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$total_contacts = $r[0]['total']; $total_contacts = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts',$total_contacts)) { if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
@ -208,7 +208,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid), intval($uid),
dbesc($network) dbesc($network)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$total_network = $r[0]['total']; $total_network = $r[0]['total'];
if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) { if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
@ -295,7 +295,7 @@ function new_contact($uid,$url,$interactive = false) {
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) { if(($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
require_once('include/salmon.php'); require_once('include/salmon.php');
slapper($r[0],$contact['notify'],$slap); slapper($r[0],$contact['notify'],$slap);

View file

@ -64,7 +64,7 @@ function gprobe_run(&$argv, &$argc){
dbesc(normalise_link($url)) dbesc(normalise_link($url))
); );
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
// Check for accessibility and do a poco discovery // Check for accessibility and do a poco discovery
if (poco_last_updated($r[0]['url'], true) AND ($r[0]["network"] == NETWORK_DFRN)) if (poco_last_updated($r[0]['url'], true) AND ($r[0]["network"] == NETWORK_DFRN))
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url'])); poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));

View file

@ -44,7 +44,7 @@ function group_rmv($uid,$name) {
intval($uid), intval($uid),
dbesc($name) dbesc($name)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$group_id = $r[0]['id']; $group_id = $r[0]['id'];
if(! $group_id) if(! $group_id)
return false; return false;
@ -106,7 +106,7 @@ function group_byname($uid,$name) {
intval($uid), intval($uid),
dbesc($name) dbesc($name)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['id']; return $r[0]['id'];
return false; return false;
} }
@ -139,7 +139,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
intval($gid), intval($gid),
intval($member) intval($member)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
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
@ -164,7 +164,7 @@ function group_get_members($gid) {
intval($gid), intval($gid),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$ret = $r; $ret = $r;
} }
return $ret; return $ret;
@ -181,7 +181,7 @@ function group_public_members($gid) {
intval(local_user()), intval(local_user()),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$ret = count($r); $ret = count($r);
} }
return $ret; return $ret;
@ -197,7 +197,7 @@ function mini_group_select($uid,$gid = 0, $label = "") {
intval($uid) intval($uid)
); );
$grps[] = array('name' => '', 'id' => '0', 'selected' => ''); $grps[] = array('name' => '', 'id' => '0', 'selected' => '');
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : '')); $grps[] = array('name' => $rr['name'], 'id' => $rr['id'], 'selected' => (($gid == $rr['id']) ? 'true' : ''));
} }
@ -255,7 +255,7 @@ function group_side($every="contacts",$each="group",$editmode = "standard", $gro
$member_of = groups_containing(local_user(),$cid); $member_of = groups_containing(local_user(),$cid);
} }
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : ''); $selected = (($group_id == $rr['id']) ? ' group-selected' : '');
@ -316,7 +316,7 @@ function expand_groups($a,$check_dead = false, $use_gcontact = false) {
$ret = array(); $ret = array();
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$ret[] = $rr['contact-id']; $ret[] = $rr['contact-id'];
if($check_dead AND !$use_gcontact) { if($check_dead AND !$use_gcontact) {
@ -345,7 +345,7 @@ function groups_containing($uid,$c) {
); );
$ret = array(); $ret = array();
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$ret[] = $rr['gid']; $ret[] = $rr['gid'];
} }

View file

@ -138,7 +138,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
$r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1",
intval($visitor['cid']) intval($visitor['cid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$profile = $r[0]['profile-id']; $profile = $r[0]['profile-id'];
break; break;
} }
@ -159,7 +159,7 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
intval($profile_int) intval($profile_int)
); );
} }
if(!dbm::is_result($r)) { if (!dbm::is_result($r)) {
$r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*, $r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.* `contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
FROM `profile` FROM `profile`
@ -289,7 +289,7 @@ function profile_sidebar($profile, $block = 0) {
'entries' => array(), 'entries' => array(),
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$profile['menu']['entries'][] = array( $profile['menu']['entries'][] = array(
@ -368,7 +368,7 @@ function profile_sidebar($profile, $block = 0) {
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))
$updated = date("c", strtotime($r[0]['updated'])); $updated = date("c", strtotime($r[0]['updated']));
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive` $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `hidden` AND NOT `archive`
@ -378,7 +378,7 @@ function profile_sidebar($profile, $block = 0) {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS) dbesc(NETWORK_OSTATUS)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$contacts = intval($r[0]['total']); $contacts = intval($r[0]['total']);
} }
} }
@ -460,7 +460,7 @@ function get_birthdays() {
dbesc(datetime_convert('UTC','UTC','now')) dbesc(datetime_convert('UTC','UTC','now'))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$total = 0; $total = 0;
$now = strtotime('now'); $now = strtotime('now');
$cids = array(); $cids = array();
@ -543,7 +543,7 @@ function get_events() {
dbesc(datetime_convert('UTC','UTC','now - 1 days')) dbesc(datetime_convert('UTC','UTC','now - 1 days'))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$now = strtotime('now'); $now = strtotime('now');
$istoday = false; $istoday = false;
foreach($r as $rr) { foreach($r as $rr) {

View file

@ -451,7 +451,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
/* check for create date and expire time */ /* check for create date and expire time */
$uid = intval($arr['uid']); $uid = intval($arr['uid']);
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid)); $r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$expire_interval = $r[0]['expire']; $expire_interval = $r[0]['expire'];
if ($expire_interval>0) { if ($expire_interval>0) {
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC')); $expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
@ -580,7 +580,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid']) intval($arr['uid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$arr['network'] = $r[0]["network"]; $arr['network'] = $r[0]["network"];
// Fallback to friendica (why is it empty in some cases?) // Fallback to friendica (why is it empty in some cases?)
@ -634,7 +634,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1", $r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1",
dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid'])); dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid']));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG); logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG);
return 0; return 0;
} }
@ -662,7 +662,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid']) intval($arr['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
// is the new message multi-level threaded? // is the new message multi-level threaded?
// even though we don't support it now, preserve the info // even though we don't support it now, preserve the info
@ -1531,7 +1531,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval($importer['uid']), intval($importer['uid']),
dbesc($url) dbesc($url)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true); update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
} }
@ -1542,7 +1542,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
); );
$a = get_app(); $a = get_app();
if(dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) { if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
// create notification // create notification
$hash = random_string(); $hash = random_string();
@ -2112,7 +2112,7 @@ function drop_item($id,$interactive = true) {
dbesc($item['parent-uri']), dbesc($item['parent-uri']),
intval($item['uid']) intval($item['uid'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d", q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]['id']) intval($r[0]['id'])
); );
@ -2148,7 +2148,7 @@ function first_post_date($uid,$wall = false) {
intval($uid), intval($uid),
intval($wall ? 1 : 0) intval($wall ? 1 : 0)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
// logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA); // logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA);
return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10); return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10);
} }

View file

@ -90,7 +90,7 @@ function do_like($item_id, $verb) {
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) {
@ -112,7 +112,7 @@ function do_like($item_id, $verb) {
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) {
@ -135,7 +135,7 @@ function do_like($item_id, $verb) {
dbesc($item_id), dbesc($item_id), dbesc($item['uri']) dbesc($item_id), dbesc($item_id), dbesc($item['uri'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$like_item = $r[0]; $like_item = $r[0];
// Already voted, undo it // Already voted, undo it

View file

@ -56,7 +56,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
dbesc($fn_name) dbesc($fn_name)
); );
if(dbm::is_result($r) && $r[0]['locked']) if (dbm::is_result($r) && $r[0]['locked'])
sleep($wait_sec); sleep($wait_sec);
} while(dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout)); } while(dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));

View file

@ -41,7 +41,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($replyto), dbesc($replyto),
dbesc($replyto) dbesc($replyto)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$convid = $r[0]['convid']; $convid = $r[0]['convid'];
} }
@ -74,7 +74,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($conv_guid), dbesc($conv_guid),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$convid = $r[0]['id']; $convid = $r[0]['id'];
} }
@ -113,7 +113,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($uri), dbesc($uri),
intval(local_user()) intval(local_user())
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$post_id = $r[0]['id']; $post_id = $r[0]['id'];
/** /**
@ -210,7 +210,7 @@ function send_wallmessage($recipient='', $body='', $subject='', $replyto=''){
dbesc($conv_guid), dbesc($conv_guid),
intval($recipient['uid']) intval($recipient['uid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$convid = $r[0]['id']; $convid = $r[0]['id'];
if(! $convid) { if(! $convid) {

View file

@ -321,7 +321,7 @@ function notifier_run(&$argv, &$argc){
intval($uid), intval($uid),
dbesc(NETWORK_DFRN) dbesc(NETWORK_DFRN)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
foreach($r as $rr) foreach($r as $rr)
$recipients_followup[] = $rr['id']; $recipients_followup[] = $rr['id'];
} }
@ -459,7 +459,7 @@ function notifier_run(&$argv, &$argc){
$r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra); $r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra);
if(dbm::is_result($r)) if (dbm::is_result($r))
$contacts = $r; $contacts = $r;
} else } else
@ -477,7 +477,7 @@ function notifier_run(&$argv, &$argc){
intval($uid), intval($uid),
dbesc(NETWORK_MAIL) dbesc(NETWORK_MAIL)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$recipients[] = $rr['id']; $recipients[] = $rr['id'];
} }
@ -505,7 +505,7 @@ function notifier_run(&$argv, &$argc){
// delivery loop // delivery loop
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $contact) { foreach($r as $contact) {
if(!$contact['self']) { if(!$contact['self']) {
@ -606,7 +606,7 @@ function notifier_run(&$argv, &$argc){
$r = array_merge($r2,$r1,$r0); $r = array_merge($r2,$r1,$r0);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG); logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
// throw everything into the queue in case we get killed // throw everything into the queue in case we get killed

View file

@ -136,7 +136,7 @@ class FKOAuth1 extends OAuthServer {
$r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1",
intval($uid) intval($uid)
); );
if(dbm::is_result($r)){ if (dbm::is_result($r)){
$record = $r[0]; $record = $r[0];
} else { } else {
logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
@ -162,7 +162,7 @@ class FKOAuth1 extends OAuthServer {
$r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->contact = $r[0]; $a->contact = $r[0];
$a->cid = $r[0]['id']; $a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid; $_SESSION['cid'] = $a->cid;

View file

@ -393,7 +393,7 @@ function onepoll_run(&$argv, &$argc){
dbesc($datarray['uri']) dbesc($datarray['uri'])
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG); logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
// Only delete when mails aren't automatically moved or deleted // Only delete when mails aren't automatically moved or deleted
@ -446,7 +446,7 @@ function onepoll_run(&$argv, &$argc){
$r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1", $r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
intval($importer_uid) intval($importer_uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item $datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
// $datarray['parent-uri'] = $r[0]['uri']; // $datarray['parent-uri'] = $r[0]['uri'];
} }
@ -479,7 +479,7 @@ function onepoll_run(&$argv, &$argc){
dbesc(protect_sprintf($datarray['title'])), dbesc(protect_sprintf($datarray['title'])),
intval($importer_uid), intval($importer_uid),
dbesc(NETWORK_MAIL)); dbesc(NETWORK_MAIL));
if(dbm::is_result($r)) if (dbm::is_result($r))
$datarray['parent-uri'] = $r[0]['parent-uri']; $datarray['parent-uri'] = $r[0]['parent-uri'];
} }

View file

@ -79,7 +79,7 @@ function reload_plugins() {
if(strlen($plugins)) { if(strlen($plugins)) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1"); $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if(dbm::is_result($r)) if (dbm::is_result($r))
$installed = $r; $installed = $r;
else else
$installed = array(); $installed = array();
@ -150,7 +150,7 @@ function register_hook($hook,$file,$function,$priority=0) {
dbesc($file), dbesc($file),
dbesc($function) dbesc($function)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return true; return true;
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ", $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
@ -187,7 +187,7 @@ function load_hooks() {
$a = get_app(); $a = get_app();
$a->hooks = array(); $a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`"); $r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`");
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks)) if(! array_key_exists($rr['hook'],$a->hooks))
$a->hooks[$rr['hook']] = array(); $a->hooks[$rr['hook']] = array();
@ -473,7 +473,7 @@ function service_class_allows($uid,$property,$usage = false) {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$service_class = $r[0]['service_class']; $service_class = $r[0]['service_class'];
} }
} }
@ -503,7 +503,7 @@ function service_class_fetch($uid,$property) {
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$service_class = $r[0]['service_class']; $service_class = $r[0]['service_class'];
} }
} }

View file

@ -28,7 +28,7 @@ function was_recently_delayed($cid) {
and last > UTC_TIMESTAMP() - interval 15 minute limit 1", and last > UTC_TIMESTAMP() - interval 15 minute limit 1",
intval($cid) intval($cid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return true; return true;
// Are there queue entries that were recently added? // Are there queue entries that were recently added?
@ -55,7 +55,7 @@ function add_to_queue($cid,$network,$msg,$batch = false) {
WHERE `queue`.`cid` = %d AND `contact`.`self` = 0 ", WHERE `queue`.`cid` = %d AND `contact`.`self` = 0 ",
intval($cid) intval($cid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if($batch && ($r[0]['total'] > $batch_queue)) { if($batch && ($r[0]['total'] > $batch_queue)) {
logger('add_to_queue: too many queued items for batch server ' . $cid . ' - discarding message'); logger('add_to_queue: too many queued items for batch server ' . $cid . ' - discarding message');
return; return;

View file

@ -42,7 +42,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$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))
$master_record = $r[0]; $master_record = $r[0];
} }
@ -50,7 +50,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
dbesc($master_record['password']), dbesc($master_record['password']),
dbesc($master_record['email']) dbesc($master_record['email'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->identities = $r; $a->identities = $r;
else else
$a->identities = array(); $a->identities = array();
@ -60,7 +60,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
and `manage`.`uid` = %d", and `manage`.`uid` = %d",
intval($master_record['uid']) intval($master_record['uid'])
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$a->identities = array_merge($a->identities,$r); $a->identities = array_merge($a->identities,$r);
if($login_initial) if($login_initial)
@ -70,7 +70,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$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($_SESSION['uid'])); intval($_SESSION['uid']));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$a->contact = $r[0]; $a->contact = $r[0];
$a->cid = $r[0]['id']; $a->cid = $r[0]['id'];
$_SESSION['cid'] = $a->cid; $_SESSION['cid'] = $a->cid;
@ -156,7 +156,7 @@ function can_write_wall(&$a,$owner) {
intval(PAGE_COMMUNITY) intval(PAGE_COMMUNITY)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$verified = 2; $verified = 2;
return true; return true;
} }
@ -210,7 +210,7 @@ function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
intval($remote_user), intval($remote_user),
intval($owner_id) intval($owner_id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$remote_verified = true; $remote_verified = true;
$groups = init_groups_visitor($remote_user); $groups = init_groups_visitor($remote_user);
} }
@ -292,7 +292,7 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
intval($remote_user), intval($remote_user),
intval($owner_id) intval($owner_id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$remote_verified = true; $remote_verified = true;
$groups = init_groups_visitor($remote_user); $groups = init_groups_visitor($remote_user);
} }
@ -403,7 +403,7 @@ function init_groups_visitor($contact_id) {
WHERE `contact-id` = %d ", WHERE `contact-id` = %d ",
intval($contact_id) intval($contact_id)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) foreach($r as $rr)
$groups[] = $rr['gid']; $groups[] = $rr['gid'];
} }

View file

@ -30,7 +30,7 @@ function ref_session_read($id) {
$r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id)); $r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$session_exists = true; $session_exists = true;
return $r[0]['data']; return $r[0]['data'];
} else { } else {

View file

@ -40,7 +40,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$r = q("select `poco`, `uid` from `contact` where `id` = %d limit 1", $r = q("select `poco`, `uid` from `contact` where `id` = %d limit 1",
intval($cid) intval($cid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$url = $r[0]['poco']; $url = $r[0]['poco'];
$uid = $r[0]['uid']; $uid = $r[0]['uid'];
} }
@ -213,14 +213,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$network = $r[0]["network"]; $network = $r[0]["network"];
if (($network == "") OR ($network == NETWORK_OSTATUS)) { if (($network == "") OR ($network == NETWORK_OSTATUS)) {
$r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1", $r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
dbesc($profile_url), dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET) dbesc($profile_url), dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$network = $r[0]["network"]; $network = $r[0]["network"];
//$profile_url = $r[0]["url"]; //$profile_url = $r[0]["url"];
} }
@ -976,7 +976,7 @@ function count_common_friends($uid,$cid) {
); );
// logger("count_common_friends: $uid $cid {$r[0]['total']}"); // logger("count_common_friends: $uid $cid {$r[0]['total']}");
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -1022,7 +1022,7 @@ function count_common_friends_zcid($uid,$zcid) {
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -1061,7 +1061,7 @@ function count_all_friends($uid,$cid) {
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
return $r[0]['total']; return $r[0]['total'];
return 0; return 0;
@ -1207,7 +1207,7 @@ function update_suggestions() {
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA) dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/')); $base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done)) if(! in_array($base,$done))

View file

@ -491,7 +491,7 @@ function item_new_uri($hostname,$uid, $guid = "") {
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri)); dbesc($uri));
if(dbm::is_result($r)) if (dbm::is_result($r))
$dups = true; $dups = true;
} while($dups == true); } while($dups == true);
return $uri; return $uri;
@ -515,7 +515,7 @@ function photo_new_resource() {
$r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `photo` WHERE `resource-id` = '%s' LIMIT 1",
dbesc($resource) dbesc($resource)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$found = true; $found = true;
} while($found == true); } while($found == true);
return $resource; return $resource;
@ -882,7 +882,7 @@ function contact_block() {
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS),
dbesc(NETWORK_DIASPORA) dbesc(NETWORK_DIASPORA)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$total = intval($r[0]['total']); $total = intval($r[0]['total']);
} }
if(! $total) { if(! $total) {
@ -901,7 +901,7 @@ function contact_block() {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
intval($shown) intval($shown)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contacts = ""; $contacts = "";
foreach ($r AS $contact) foreach ($r AS $contact)
$contacts[] = $contact["id"]; $contacts[] = $contact["id"];
@ -909,7 +909,7 @@ function contact_block() {
$r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)", $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)",
dbesc(implode(",", $contacts))); dbesc(implode(",", $contacts)));
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
$micropro = Array(); $micropro = Array();
foreach($r as $rr) { foreach($r as $rr) {
@ -1932,7 +1932,7 @@ function file_tag_update_pconfig($uid,$file_old,$file_new,$type = 'file') {
// intval($uid) // intval($uid)
//); //);
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
unset($deleted_tags[$key]); unset($deleted_tags[$key]);
} }
else { else {
@ -1962,7 +1962,7 @@ function file_tag_save_file($uid,$item,$file) {
intval($item), intval($item),
intval($uid) intval($uid)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']')) if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
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($r[0]['file'] . '[' . file_tag_encode($file) . ']'), dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),

View file

@ -174,7 +174,7 @@ function add_shadow_entry($itemid) {
function update_thread_uri($itemuri, $uid) { function update_thread_uri($itemuri, $uid) {
$messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid));
if(dbm::is_result($messages)) if (dbm::is_result($messages))
foreach ($messages as $message) foreach ($messages as $message)
update_thread($message["id"]); update_thread($message["id"]);
} }

View file

@ -130,7 +130,7 @@ function create_user($arr) {
$r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `email` = '%s' LIMIT 1",
dbesc($email) dbesc($email)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$result['message'] .= t('Cannot use that email.') . EOL; $result['message'] .= t('Cannot use that email.') . EOL;
} }
@ -143,7 +143,7 @@ function create_user($arr) {
WHERE `nickname` = '%s' LIMIT 1", WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$result['message'] .= t('Nickname is already registered. Please choose another.') . EOL; $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
// Check deleted accounts that had this nickname. Doesn't matter to us, // Check deleted accounts that had this nickname. Doesn't matter to us,
@ -153,7 +153,7 @@ function create_user($arr) {
WHERE `username` = '%s' LIMIT 1", WHERE `username` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
); );
if(dbm::is_result($r)) if (dbm::is_result($r))
$result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL; $result['message'] .= t('Nickname was once registered here and may not be re-used. Please choose another.') . EOL;
if(strlen($result['message'])) { if(strlen($result['message'])) {
@ -222,7 +222,7 @@ function create_user($arr) {
dbesc($username), dbesc($username),
dbesc($new_password_encoded) dbesc($new_password_encoded)
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$u = $r[0]; $u = $r[0];
$newuid = intval($r[0]['uid']); $newuid = intval($r[0]['uid']);
} }
@ -302,7 +302,7 @@ function create_user($arr) {
intval($newuid), intval($newuid),
dbesc(t('Friends')) dbesc(t('Friends'))
); );
if(dbm::is_result($r)) { if (dbm::is_result($r)) {
$def_gid = $r[0]['id']; $def_gid = $r[0]['id'];
q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d", q("UPDATE `user` SET `def_gid` = %d WHERE `uid` = %d",