@ -413,7 +413,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
/* check for create date and expire time */
$uid = intval ( $arr [ 'uid' ]);
$r = q ( " SELECT expire FROM user WHERE uid = %d " , intval ( $uid ));
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
$expire_interval = $r [ 0 ][ 'expire' ];
if ( $expire_interval > 0 ) {
$expire_date = new DateTime ( '- ' . $expire_interval . ' days' , new DateTimeZone ( 'UTC' ));
@ -535,7 +535,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval ( $arr [ 'uid' ])
);
if ( coun t( $r ))
if ( dba :: is_resul t( $r ))
$arr [ 'network' ] = $r [ 0 ][ " network " ];
// Fallback to friendica (why is it empty in some cases?)
@ -583,7 +583,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 " ,
dbesc ( $arr [ 'guid' ]), dbesc ( $arr [ 'network' ]), intval ( $arr [ 'uid' ]));
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
logger ( 'found item with guid ' . $arr [ 'guid' ] . ' for user ' . $arr [ 'uid' ] . ' on network ' . $arr [ 'network' ], LOGGER_DEBUG );
return 0 ;
}
@ -612,7 +612,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval ( $arr [ 'uid' ])
);
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
// is the new message multi-level threaded?
// even though we don't support it now, preserve the info
@ -768,7 +768,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval ( $r [ 0 ][ " id " ])
);
return 0 ;
} elseif ( coun t( $r )) {
} elseif ( dba :: is_resul t( $r )) {
$current_post = $r [ 0 ][ 'id' ];
logger ( 'item_store: created item ' . $current_post );
@ -979,7 +979,7 @@ function item_body_set_hashtags(&$item) {
function get_item_guid ( $id ) {
$r = q ( " SELECT `guid` FROM `item` WHERE `id` = %d LIMIT 1 " , intval ( $id ));
if ( coun t( $r ))
if ( dba :: is_resul t( $r ))
return ( $r [ 0 ][ " guid " ]);
else
return ( " " );
@ -998,7 +998,7 @@ function get_item_id($guid, $uid = 0) {
$r = q ( " SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item` . `visible` = 1 AND `item` . `deleted` = 0 and `item` . `moderated` = 0
AND `item` . `guid` = '%s' AND `item` . `uid` = % d " , dbesc( $guid ), intval( $uid ));
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
$id = $r [ 0 ][ " id " ];
$nick = $r [ 0 ][ " nickname " ];
}
@ -1012,7 +1012,7 @@ function get_item_id($guid, $uid = 0) {
AND `item` . `deny_cid` = '' AND `item` . `deny_gid` = ''
AND `item` . `private` = 0 AND `item` . `wall` = 1
AND `item` . `guid` = '%s' " , dbesc( $guid ));
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
$id = $r [ 0 ][ " id " ];
$nick = $r [ 0 ][ " nickname " ];
}
@ -1313,7 +1313,7 @@ function item_is_remote_self($contact, &$datarray) {
if ( $contact [ 'remote_self' ] == 2 ) {
$r = q ( " SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` " ,
intval ( $contact [ 'uid' ]));
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
$datarray [ 'contact-id' ] = $r [ 0 ][ " id " ];
$datarray [ 'owner-name' ] = $r [ 0 ][ " name " ];
@ -1390,7 +1390,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval ( $importer [ 'uid' ]),
dbesc ( $url )
);
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
$contact_record = $r [ 0 ];
$photos = import_profile_photo ( $photo , $importer [ " uid " ], $contact_record [ " id " ]);
@ -1982,7 +1982,7 @@ function drop_item($id,$interactive = true) {
dbesc ( $item [ 'parent-uri' ]),
intval ( $item [ 'uid' ])
);
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
q ( " UPDATE `item` SET `last-child` = 1 WHERE `id` = %d " ,
intval ( $r [ 0 ][ 'id' ])
);
@ -2019,7 +2019,7 @@ function first_post_date($uid,$wall = false) {
intval ( $uid ),
intval ( $wall ? 1 : 0 )
);
if ( coun t( $r )) {
if ( dba :: is_resul t( $r )) {
// 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 );
}