converted more to dbm::is_result() + added braces/space
Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
268f90a705
commit
c0cc65304b
|
@ -2355,7 +2355,7 @@ class dfrn {
|
||||||
dbesc($xt->id),
|
dbesc($xt->id),
|
||||||
intval($importer["importer_uid"])
|
intval($importer["importer_uid"])
|
||||||
);
|
);
|
||||||
if(count($i)) {
|
if (dbm::is_result($i)) {
|
||||||
|
|
||||||
// For tags, the owner cannot remove the tag on the author's copy of the post.
|
// For tags, the owner cannot remove the tag on the author's copy of the post.
|
||||||
|
|
||||||
|
|
|
@ -704,7 +704,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||||
// If its a post from myself then tag the thread as "mention"
|
// If its a post from myself then tag the thread as "mention"
|
||||||
logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG);
|
logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG);
|
||||||
$u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
|
$u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
|
||||||
if (count($u)) {
|
if (dbm::is_result($u)) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
|
$self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
|
||||||
logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
|
logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
|
||||||
|
@ -1188,19 +1188,22 @@ function tag_deliver($uid,$item_id) {
|
||||||
$u = q("select * from user where uid = %d limit 1",
|
$u = q("select * from user where uid = %d limit 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if (! count($u))
|
|
||||||
|
if (! dbm::is_result($u)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
||||||
|
|
||||||
|
|
||||||
$i = q("select * from item where id = %d and uid = %d limit 1",
|
$i = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($item_id),
|
intval($item_id),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if (! count($i))
|
if (! dbm::is_result($i)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$item = $i[0];
|
$item = $i[0];
|
||||||
|
|
||||||
|
@ -1298,12 +1301,13 @@ function tgroup_check($uid,$item) {
|
||||||
if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
|
if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/// @TODO Encapsulate this or find it encapsulated and replace all occurrances
|
||||||
$u = q("select * from user where uid = %d limit 1",
|
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if (! count($u))
|
if (! dbm::is_result($u)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
||||||
|
|
|
@ -126,7 +126,7 @@ function queue_run(&$argv, &$argc){
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||||
intval($qi[0]['cid'])
|
intval($qi[0]['cid'])
|
||||||
);
|
);
|
||||||
if(! count($c)) {
|
if (! dbm::is_result($c)) {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ function queue_run(&$argv, &$argc){
|
||||||
FROM `user` WHERE `uid` = %d LIMIT 1",
|
FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||||
intval($c[0]['uid'])
|
intval($c[0]['uid'])
|
||||||
);
|
);
|
||||||
if(! count($u)) {
|
if (! dbm::is_result($u)) {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ function create_user($arr) {
|
||||||
intval($netpublish)
|
intval($netpublish)
|
||||||
|
|
||||||
);
|
);
|
||||||
if($r === false) {
|
if ($r === false) {
|
||||||
$result['message'] .= t('An error occurred creating your default profile. Please try again.') . EOL;
|
$result['message'] .= t('An error occurred creating your default profile. Please try again.') . EOL;
|
||||||
// Start fresh next time.
|
// Start fresh next time.
|
||||||
$r = q("DELETE FROM `user` WHERE `uid` = %d",
|
$r = q("DELETE FROM `user` WHERE `uid` = %d",
|
||||||
|
@ -325,24 +325,27 @@ function create_user($arr) {
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
|
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
$img->scaleImage(80);
|
$img->scaleImage(80);
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
|
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
$img->scaleImage(48);
|
$img->scaleImage(48);
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
|
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(! $photo_failure) {
|
if (! $photo_failure) {
|
||||||
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
|
q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
|
||||||
dbesc($hash)
|
dbesc($hash)
|
||||||
);
|
);
|
||||||
|
|
|
@ -48,8 +48,9 @@ function common_content(App &$a) {
|
||||||
$a->page['aside'] .= $vcard_widget;
|
$a->page['aside'] .= $vcard_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! count($c))
|
if (! dbm::is_result($c)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(! $cid) {
|
if(! $cid) {
|
||||||
if(get_my_url()) {
|
if(get_my_url()) {
|
||||||
|
|
|
@ -415,23 +415,26 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($r === false)
|
/// @TODO is dbm::is_result() working here?
|
||||||
|
if ($r === false) {
|
||||||
notice( t('Unable to set contact photo.') . EOL);
|
notice( t('Unable to set contact photo.') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
// reload contact info
|
// reload contact info
|
||||||
|
|
||||||
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
|
if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
|
||||||
|
|
||||||
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
|
if (($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
|
||||||
require_once('include/diaspora.php');
|
require_once('include/diaspora.php');
|
||||||
$ret = diaspora::send_share($user[0],$r[0]);
|
$ret = diaspora::send_share($user[0],$r[0]);
|
||||||
logger('share returns: ' . $ret);
|
logger('share returns: ' . $ret);
|
||||||
|
|
|
@ -137,7 +137,7 @@ function dfrn_poll_init(App &$a) {
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||||
intval($r[0]['cid'])
|
intval($r[0]['cid'])
|
||||||
);
|
);
|
||||||
if(! count($c)) {
|
if (! dbm::is_result($c)) {
|
||||||
xml_status(3, 'No profile');
|
xml_status(3, 'No profile');
|
||||||
}
|
}
|
||||||
$contact = $c[0];
|
$contact = $c[0];
|
||||||
|
@ -234,7 +234,7 @@ function dfrn_poll_post(App &$a) {
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||||
intval($r[0]['cid'])
|
intval($r[0]['cid'])
|
||||||
);
|
);
|
||||||
if(! count($c)) {
|
if (! dbm::is_result($c)) {
|
||||||
xml_status(3, 'No profile');
|
xml_status(3, 'No profile');
|
||||||
}
|
}
|
||||||
$contact = $c[0];
|
$contact = $c[0];
|
||||||
|
|
|
@ -23,7 +23,7 @@ function editpost_content(App &$a) {
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! count($itm)) {
|
if (! dbm::is_result($itm)) {
|
||||||
notice( t('Item not found') . EOL);
|
notice( t('Item not found') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,8 +224,9 @@ function item_post(App &$a) {
|
||||||
intval($profile_uid),
|
intval($profile_uid),
|
||||||
intval($post_id)
|
intval($post_id)
|
||||||
);
|
);
|
||||||
if(! count($i))
|
if (! dbm::is_result($i)) {
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
$orig_post = $i[0];
|
$orig_post = $i[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ function photos_post(App &$a) {
|
||||||
dbesc($r[0]['resource-id']),
|
dbesc($r[0]['resource-id']),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
if (count($i)) {
|
if (dbm::is_result($i)) {
|
||||||
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
|
|
@ -16,8 +16,9 @@ function poco_init(App &$a) {
|
||||||
}
|
}
|
||||||
if(! x($user)) {
|
if(! x($user)) {
|
||||||
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
|
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
|
||||||
if(! count($c))
|
if (! dbm::is_result($c)) {
|
||||||
http_status_exit(401);
|
http_status_exit(401);
|
||||||
|
}
|
||||||
$system_mode = true;
|
$system_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,22 +73,25 @@ function profile_photo_post(App &$a) {
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
|
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
|
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
|
||||||
|
}
|
||||||
|
|
||||||
$im->scaleImage(80);
|
$im->scaleImage(80);
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
|
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
|
||||||
|
}
|
||||||
|
|
||||||
$im->scaleImage(48);
|
$im->scaleImage(48);
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
|
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
|
||||||
|
}
|
||||||
|
|
||||||
// If setting for the default profile, unset the profile photo flag from any other photos I own
|
// If setting for the default profile, unset the profile photo flag from any other photos I own
|
||||||
|
|
||||||
|
@ -282,15 +285,17 @@ function profile_photo_content(App &$a) {
|
||||||
if(! function_exists('profile_photo_crop_ui_head')) {
|
if(! function_exists('profile_photo_crop_ui_head')) {
|
||||||
function profile_photo_crop_ui_head(&$a, $ph){
|
function profile_photo_crop_ui_head(&$a, $ph){
|
||||||
$max_length = get_config('system','max_image_length');
|
$max_length = get_config('system','max_image_length');
|
||||||
if(! $max_length)
|
if (! $max_length) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
if($max_length > 0)
|
}
|
||||||
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$ph->scaleImage($max_length);
|
||||||
|
}
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $ph->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $ph->getHeight();
|
||||||
|
|
||||||
if($width < 175 || $height < 175) {
|
if ($width < 175 || $height < 175) {
|
||||||
$ph->scaleImageUp(200);
|
$ph->scaleImageUp(200);
|
||||||
$width = $ph->getWidth();
|
$width = $ph->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $ph->getHeight();
|
||||||
|
@ -303,20 +308,22 @@ function profile_photo_crop_ui_head(&$a, $ph){
|
||||||
|
|
||||||
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
|
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
|
||||||
|
|
||||||
if($r)
|
if ($r) {
|
||||||
info( t('Image uploaded successfully.') . EOL );
|
info( t('Image uploaded successfully.') . EOL );
|
||||||
else
|
} else {
|
||||||
notice( t('Image upload failed.') . EOL );
|
notice( t('Image upload failed.') . EOL );
|
||||||
|
}
|
||||||
|
|
||||||
if($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$ph->scaleImage(640);
|
||||||
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
|
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
|
||||||
|
|
||||||
if($r === false)
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
|
||||||
else
|
} else {
|
||||||
$smallest = 1;
|
$smallest = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$a->config['imagecrop'] = $hash;
|
$a->config['imagecrop'] = $hash;
|
||||||
$a->config['imagecrop_resolution'] = $smallest;
|
$a->config['imagecrop_resolution'] = $smallest;
|
||||||
|
|
|
@ -154,7 +154,7 @@ function videos_post(App &$a) {
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
//echo "<pre>"; var_dump($i); killme();
|
//echo "<pre>"; var_dump($i); killme();
|
||||||
if(count($i)) {
|
if (dbm::is_result($i)) {
|
||||||
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
|
Loading…
Reference in a new issue