mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
more backquotes - this should take care of most except for the array import queries
This commit is contained in:
parent
2bdf135cbc
commit
e7233c0c94
30 changed files with 66 additions and 67 deletions
|
@ -133,10 +133,9 @@ class Accounts {
|
|||
$base = z_root() . '/admin/accounts?f=';
|
||||
$odir = (($dir === 'asc') ? '0' : '1');
|
||||
|
||||
$users = q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d ) > 0 as `blocked`, " .
|
||||
"(SELECT %s FROM channel as ch " .
|
||||
"WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as `channels` " .
|
||||
"FROM account as ac where true $serviceclass order by $key $dir limit %d offset %d ",
|
||||
$users = q("SELECT account_id , account_email, account_lastlog, account_created, account_expires, account_service_class, ( account_flags & %d ) > 0 as blocked,
|
||||
(SELECT %s FROM channel as ch WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as channels FROM account as ac
|
||||
where true $serviceclass order by $key $dir limit %d offset %d ",
|
||||
intval(ACCOUNT_BLOCKED),
|
||||
db_concat('ch.channel_address', ' '),
|
||||
intval(\App::$pager['itemspage']),
|
||||
|
|
|
@ -42,7 +42,7 @@ class Dbsync {
|
|||
}
|
||||
|
||||
$failed = array();
|
||||
$r = q("select * from config where `cat` = 'database' ");
|
||||
$r = q("select * from config where cat = 'database' ");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$upd = intval(substr($rr['k'],8));
|
||||
|
|
|
@ -96,7 +96,7 @@ class Connedit extends \Zotlabs\Web\Controller {
|
|||
|
||||
$profile_id = $_POST['profile_assign'];
|
||||
if($profile_id) {
|
||||
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND uid = %d LIMIT 1",
|
||||
dbesc($profile_id),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ class Contactgroup extends \Zotlabs\Web\Controller {
|
|||
|
||||
if((argc() > 1) && (intval(argv(1)))) {
|
||||
|
||||
$r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
|
||||
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d AND deleted = 0 LIMIT 1",
|
||||
intval(argv(1)),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
|
|
@ -309,7 +309,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
|
|||
$havescale = true;
|
||||
}
|
||||
|
||||
$r = q("SELECT `content`, `mimetype`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
|
||||
$r = q("SELECT content, mimetype, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1",
|
||||
intval($r[0]['id']),
|
||||
intval(local_channel())
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ class Dirsearch extends \Zotlabs\Web\Controller {
|
|||
else {
|
||||
$qlimit = " LIMIT " . intval($perpage) . " OFFSET " . intval($startrec);
|
||||
if($return_total) {
|
||||
$r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql ");
|
||||
$r = q("SELECT COUNT(xchan_hash) AS total FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql ");
|
||||
if($r) {
|
||||
$ret['total_items'] = $r[0]['total'];
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class Editblock extends \Zotlabs\Web\Controller {
|
|||
return;
|
||||
}
|
||||
|
||||
$itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
|
||||
$itm = q("SELECT * FROM item WHERE id = %d and uid = %s LIMIT 1",
|
||||
intval($post_id),
|
||||
intval($owner)
|
||||
);
|
||||
|
|
|
@ -91,7 +91,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
|
|||
return;
|
||||
}
|
||||
|
||||
$itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1",
|
||||
$itm = q("SELECT * FROM item WHERE id = %d and uid = %s LIMIT 1",
|
||||
intval($post_id),
|
||||
intval($owner)
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ class Editpost extends \Zotlabs\Web\Controller {
|
|||
return;
|
||||
}
|
||||
|
||||
$itm = q("SELECT * FROM `item` WHERE `id` = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1",
|
||||
$itm = q("SELECT * FROM item WHERE id = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1",
|
||||
intval($post_id),
|
||||
dbesc(get_observer_hash()),
|
||||
dbesc(get_observer_hash())
|
||||
|
|
|
@ -95,7 +95,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
|
|||
|
||||
$sql_extra = item_permissions_sql($owner);
|
||||
|
||||
$itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s $sql_extra LIMIT 1",
|
||||
$itm = q("SELECT * FROM item WHERE id = %d and uid = %s $sql_extra LIMIT 1",
|
||||
intval($post_id),
|
||||
intval($owner)
|
||||
);
|
||||
|
|
|
@ -32,7 +32,7 @@ class Fbrowser extends \Zotlabs\Web\Controller {
|
|||
$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
|
||||
|
||||
if (\App::$argc==2){
|
||||
$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
|
||||
$albums = q("SELECT distinct(album) AS album FROM photo WHERE uid = %d ",
|
||||
intval(local_channel())
|
||||
);
|
||||
// anon functions only from 5.3.0... meglio tardi che mai..
|
||||
|
@ -43,14 +43,14 @@ class Fbrowser extends \Zotlabs\Web\Controller {
|
|||
$album = "";
|
||||
if (\App::$argc==3){
|
||||
$album = hex2bin(\App::$argv[2]);
|
||||
$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
|
||||
$sql_extra = sprintf("AND album = '%s' ",dbesc($album));
|
||||
$sql_extra2 = "";
|
||||
$path[]=array(z_root() . "/fbrowser/image/" . \App::$argv[2] . "/", $album);
|
||||
}
|
||||
|
||||
$r = q("SELECT `resource_id`, `id`, `filename`, type, min(`imgscale`) AS `hiq`,max(`imgscale`) AS `loq`, `description`
|
||||
FROM `photo` WHERE `uid` = %d $sql_extra
|
||||
GROUP BY `resource_id` $sql_extra2",
|
||||
$r = q("SELECT resource_id, id, filename, type, min(imgscale) AS hiq,max(imgscale) AS loq, description
|
||||
FROM photo WHERE uid = %d $sql_extra
|
||||
GROUP BY resource_id $sql_extra2",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Fbrowser extends \Zotlabs\Web\Controller {
|
|||
break;
|
||||
case "file":
|
||||
if (\App::$argc==2){
|
||||
$files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
|
||||
$files = q("SELECT id, filename, filetype FROM attach WHERE uid = %d ",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class Invite extends \Zotlabs\Web\Controller {
|
|||
$invite_code = autoname(8) . rand(1000,9999);
|
||||
$nmessage = str_replace('$invite_code',$invite_code,$message);
|
||||
|
||||
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
|
||||
$r = q("INSERT INTO register (hash,created) VALUES ('%s', '%s') ",
|
||||
dbesc($invite_code),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ class Match extends \Zotlabs\Web\Controller {
|
|||
|
||||
$o .= '<h2>' . t('Profile Match') . '</h2>';
|
||||
|
||||
$r = q("SELECT `keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT keywords FROM profile WHERE is_default = 1 AND uid = %d LIMIT 1",
|
||||
intval(local_channel())
|
||||
);
|
||||
if (! count($r))
|
||||
|
|
|
@ -201,7 +201,7 @@ class Network extends \Zotlabs\Web\Controller {
|
|||
|
||||
$sql_nets = '';
|
||||
|
||||
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE item_thread_top = 1 $sql_options ) ";
|
||||
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) ";
|
||||
|
||||
if($group) {
|
||||
$contact_str = '';
|
||||
|
|
|
@ -183,7 +183,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||
// they won't have the photo link, so there's a reasonable chance that the person
|
||||
// might be able to obtain permission to view it.
|
||||
|
||||
$r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
|
||||
dbesc($photo),
|
||||
intval($resolution)
|
||||
);
|
||||
|
|
|
@ -149,7 +149,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
|
|||
|
||||
if($is_default_profile) {
|
||||
$r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d
|
||||
AND resource_id != '%s' AND `uid` = %d",
|
||||
AND resource_id != '%s' AND uid = %d",
|
||||
intval(PHOTO_NORMAL),
|
||||
intval(PHOTO_PROFILE),
|
||||
dbesc($base_image['resource_id']),
|
||||
|
|
|
@ -55,7 +55,7 @@ class Profperm extends \Zotlabs\Web\Controller {
|
|||
|
||||
|
||||
if((argc() > 1) && (intval(argv(1)))) {
|
||||
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1",
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d AND is_default = 0 LIMIT 1",
|
||||
intval(argv(1)),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
|
|
@ -289,7 +289,7 @@ class Channel {
|
|||
$yes_no = array(t('No'),t('Yes'));
|
||||
|
||||
|
||||
$p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1",
|
||||
$p = q("SELECT * FROM profile WHERE is_default = 1 AND uid = %d LIMIT 1",
|
||||
intval(local_channel())
|
||||
);
|
||||
if(count($p))
|
||||
|
|
|
@ -19,7 +19,7 @@ class Featured {
|
|||
|
||||
$o = '';
|
||||
|
||||
$r = q("SELECT * FROM `hook` WHERE `hook` = 'feature_settings' ");
|
||||
$r = q("SELECT * FROM hook WHERE hook = 'feature_settings' ");
|
||||
if(! $r)
|
||||
$settings_addons = t('No feature settings configured');
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class Tasks extends \Zotlabs\Web\Controller {
|
|||
|
||||
if((argc() > 2) && (argv(1) === 'complete') && intval(argv(2))) {
|
||||
$ret = array('success' => false);
|
||||
$r = q("select * from event where `etype` = 'task' and uid = %d and id = %d limit 1",
|
||||
$r = q("select * from event where etype = 'task' and uid = %d and id = %d limit 1",
|
||||
intval(local_channel()),
|
||||
intval(argv(2))
|
||||
);
|
||||
|
|
|
@ -540,7 +540,7 @@ function identity_basic_export($channel_id, $items = false) {
|
|||
$ret['hubloc'] = $r;
|
||||
}
|
||||
|
||||
$r = q("select * from `groups` where uid = %d ",
|
||||
$r = q("select * from groups where uid = %d ",
|
||||
intval($channel_id)
|
||||
);
|
||||
|
||||
|
@ -903,7 +903,7 @@ function profile_load($nickname, $profile = '') {
|
|||
// fetch user tags if this isn't the default profile
|
||||
|
||||
if(! $p[0]['is_default']) {
|
||||
$x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1",
|
||||
$x = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
|
||||
intval($p[0]['profile_uid'])
|
||||
);
|
||||
if($x && $can_view_profile)
|
||||
|
|
|
@ -297,16 +297,16 @@ function channel_remove($channel_id, $local = true, $unset_session=false) {
|
|||
}
|
||||
|
||||
|
||||
q("DELETE FROM `groups` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `group_member` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `event` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `item` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `mail` WHERE `channel_id` = %d", intval($channel_id));
|
||||
q("DELETE FROM `notify` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `photo` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `attach` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `profile` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($channel_id));
|
||||
q("DELETE FROM groups WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM group_member WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM event WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM item WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM mail WHERE channel_id = %d", intval($channel_id));
|
||||
q("DELETE FROM notify WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM photo WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM attach WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM profile WHERE uid = %d", intval($channel_id));
|
||||
q("DELETE FROM pconfig WHERE uid = %d", intval($channel_id));
|
||||
|
||||
// @FIXME At this stage we need to remove the file resources located under /store/$nickname
|
||||
|
||||
|
|
|
@ -269,8 +269,8 @@ function localize_item(&$item){
|
|||
// (and update to json storage)
|
||||
|
||||
if (activity_match($item['verb'],ACTIVITY_TAG)) {
|
||||
$r = q("SELECT * from `item`,`contact` WHERE
|
||||
`item`.`contact-id`=`contact`.`id` AND `item`.`mid`='%s';",
|
||||
$r = q("SELECT * from item,contact WHERE
|
||||
item.contact-id=contact.id AND item.mid='%s';",
|
||||
dbesc($item['parent_mid']));
|
||||
if(count($r)==0) return;
|
||||
$obj=$r[0];
|
||||
|
|
|
@ -1717,7 +1717,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||
// find the parent and snarf the item id and ACL's
|
||||
// and anything else we need to inherit
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1",
|
||||
dbesc($arr['parent_mid']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
@ -1749,8 +1749,8 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||
|
||||
if($r[0]['mid'] != $r[0]['parent_mid']) {
|
||||
$arr['parent_mid'] = $r[0]['parent_mid'];
|
||||
$z = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `parent_mid` = '%s' AND `uid` = %d
|
||||
ORDER BY `id` ASC LIMIT 1",
|
||||
$z = q("SELECT * FROM item WHERE mid = '%s' AND parent_mid = '%s' AND uid = %d
|
||||
ORDER BY id ASC LIMIT 1",
|
||||
dbesc($r[0]['parent_mid']),
|
||||
dbesc($r[0]['parent_mid']),
|
||||
intval($arr['uid'])
|
||||
|
@ -1801,7 +1801,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||
if($parent_deleted)
|
||||
$arr['item_deleted'] = 1;
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `mid` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
dbesc($arr['mid']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
@ -1863,7 +1863,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||
|
||||
// find the item we just created
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `uid` = %d ORDER BY `id` ASC ",
|
||||
$r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC ",
|
||||
$arr['mid'], // already dbesc'd
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
@ -1880,7 +1880,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||
}
|
||||
if(count($r) > 1) {
|
||||
logger('item_store: duplicated post occurred. Removing duplicates.');
|
||||
q("DELETE FROM `item` WHERE `mid` = '%s' AND `uid` = %d AND `id` != %d ",
|
||||
q("DELETE FROM item WHERE mid = '%s' AND uid = %d AND id != %d ",
|
||||
$arr['mid'],
|
||||
intval($arr['uid']),
|
||||
intval($current_post)
|
||||
|
@ -2177,7 +2177,7 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
|
|||
$str .= " `" . $k . "` = '" . $v . "' ";
|
||||
}
|
||||
|
||||
$r = dbq("update `item` set " . $str . " where id = " . $orig_post_id );
|
||||
$r = dbq("update item set " . $str . " where id = " . $orig_post_id );
|
||||
|
||||
if($r)
|
||||
logger('item_store_update: updated item ' . $orig_post_id, LOGGER_DEBUG);
|
||||
|
@ -3066,7 +3066,7 @@ function mail_store($arr) {
|
|||
$arr['parent_mid'] = $arr['mid'];
|
||||
}
|
||||
|
||||
$r = q("SELECT `id` FROM mail WHERE `mid` = '%s' AND channel_id = %d LIMIT 1",
|
||||
$r = q("SELECT id FROM mail WHERE mid = '%s' AND channel_id = %d LIMIT 1",
|
||||
dbesc($arr['mid']),
|
||||
intval($arr['channel_id'])
|
||||
);
|
||||
|
@ -3100,7 +3100,7 @@ function mail_store($arr) {
|
|||
|
||||
// find the item we just created
|
||||
|
||||
$r = q("SELECT `id` FROM mail WHERE `mid` = '%s' AND `channel_id` = %d ORDER BY `id` ASC ",
|
||||
$r = q("SELECT id FROM mail WHERE mid = '%s' AND channel_id = %d ORDER BY id ASC ",
|
||||
$arr['mid'], // already dbesc'd
|
||||
intval($arr['channel_id'])
|
||||
);
|
||||
|
@ -3116,7 +3116,7 @@ function mail_store($arr) {
|
|||
}
|
||||
if(count($r) > 1) {
|
||||
logger('mail_store: duplicated post occurred. Removing duplicates.');
|
||||
q("DELETE FROM mail WHERE `mid` = '%s' AND `channel_id` = %d AND `id` != %d ",
|
||||
q("DELETE FROM mail WHERE mid = '%s' AND channel_id = %d AND id != %d ",
|
||||
$arr['mid'],
|
||||
intval($arr['channel_id']),
|
||||
intval($current_post)
|
||||
|
@ -3168,7 +3168,7 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
|
|||
if($x) {
|
||||
$res = substr($i,$x+1);
|
||||
$i = substr($i,0,$x);
|
||||
$r = q("SELECT * FROM `photo` WHERE `resource_id` = '%s' AND `imgscale` = %d AND `uid` = %d",
|
||||
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d AND uid = %d",
|
||||
dbesc($i),
|
||||
intval($res),
|
||||
intval($uid)
|
||||
|
@ -3883,8 +3883,8 @@ function zot_feed($uid,$observer_hash,$arr) {
|
|||
$sys_query = ((is_sys_channel($uid)) ? $sql_extra : '');
|
||||
$item_normal = item_normal();
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item`
|
||||
WHERE `item`.`parent` IN ( %s ) $item_normal $sys_query ",
|
||||
$items = q("SELECT item.*, item.id AS item_id FROM item
|
||||
WHERE item.parent IN ( %s ) $item_normal $sys_query ",
|
||||
dbesc($parents_str)
|
||||
);
|
||||
}
|
||||
|
@ -3952,7 +3952,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||
$sql_extra .= protect_sprintf(term_query('item', $arr['cat'], TERM_CATEGORY));
|
||||
|
||||
if($arr['gid'] && $uid) {
|
||||
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($arr['group']),
|
||||
intval($uid)
|
||||
);
|
||||
|
|
|
@ -392,7 +392,7 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee
|
|||
|
||||
|
||||
if($updateseen) {
|
||||
$r = q("UPDATE `mail` SET mail_seen = 1 where mail_seen = 0 and id = %d AND channel_id = %d",
|
||||
$r = q("UPDATE mail SET mail_seen = 1 where mail_seen = 0 and id = %d AND channel_id = %d",
|
||||
dbesc($messageitem_id),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
@ -516,7 +516,7 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda
|
|||
|
||||
|
||||
if($updateseen) {
|
||||
$r = q("UPDATE `mail` SET mail_seen = 1 where mail_seen = 0 and parent_mid = '%s' AND channel_id = %d",
|
||||
$r = q("UPDATE mail SET mail_seen = 1 where mail_seen = 0 and parent_mid = '%s' AND channel_id = %d",
|
||||
dbesc($r[0]['parent_mid']),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
|
|
@ -549,7 +549,7 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f
|
|||
|
||||
function init_groups_visitor($contact_id) {
|
||||
$groups = array();
|
||||
$r = q("SELECT hash FROM `groups` left join group_member on groups.id = group_member.gid WHERE xchan = '%s' ",
|
||||
$r = q("SELECT hash FROM groups left join group_member on groups.id = group_member.gid WHERE xchan = '%s' ",
|
||||
dbesc($contact_id)
|
||||
);
|
||||
if($r) {
|
||||
|
|
|
@ -7,7 +7,7 @@ function contact_profile_assign($current) {
|
|||
|
||||
$o .= "<select id=\"contact-profile-selector\" name=\"profile_assign\" class=\"form-control\"/>\r\n";
|
||||
|
||||
$r = q("SELECT profile_guid, profile_name FROM `profile` WHERE `uid` = %d",
|
||||
$r = q("SELECT profile_guid, profile_name FROM profile WHERE uid = %d",
|
||||
intval($_SESSION['uid']));
|
||||
|
||||
if($r) {
|
||||
|
|
|
@ -64,7 +64,7 @@ function update_channels_active_monthly_stat() {
|
|||
}
|
||||
|
||||
function update_local_posts_stat() {
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE item_wall = 1 ");
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM item WHERE item_wall = 1 ");
|
||||
if (is_array($posts)) {
|
||||
$local_posts_stat = intval($posts[0]["local_posts"]);
|
||||
set_config('system','local_posts_stat',$local_posts_stat);
|
||||
|
|
|
@ -214,13 +214,13 @@ function widget_savedsearch($arr) {
|
|||
$search = ((x($_GET,'search')) ? $_GET['search'] : '');
|
||||
|
||||
if(x($_GET,'searchsave') && $search) {
|
||||
$r = q("select * from `term` where `uid` = %d and `ttype` = %d and `term` = '%s' limit 1",
|
||||
$r = q("select * from term where uid = %d and ttype = %d and term = '%s' limit 1",
|
||||
intval(local_channel()),
|
||||
intval(TERM_SAVEDSEARCH),
|
||||
dbesc($search)
|
||||
);
|
||||
if(! $r) {
|
||||
q("insert into `term` ( `uid`,`ttype`,`term` ) values ( %d, %d, '%s') ",
|
||||
q("insert into term ( uid,ttype,term ) values ( %d, %d, '%s') ",
|
||||
intval(local_channel()),
|
||||
intval(TERM_SAVEDSEARCH),
|
||||
dbesc($search)
|
||||
|
@ -229,7 +229,7 @@ function widget_savedsearch($arr) {
|
|||
}
|
||||
|
||||
if(x($_GET,'searchremove') && $search) {
|
||||
q("delete from `term` where `uid` = %d and `ttype` = %d and `term` = '%s'",
|
||||
q("delete from term where uid = %d and ttype = %d and term = '%s'",
|
||||
intval(local_channel()),
|
||||
intval(TERM_SAVEDSEARCH),
|
||||
dbesc($search)
|
||||
|
@ -256,7 +256,7 @@ function widget_savedsearch($arr) {
|
|||
|
||||
$o = '';
|
||||
|
||||
$r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `ttype` = %d ",
|
||||
$r = q("select tid,term from term WHERE uid = %d and ttype = %d ",
|
||||
intval(local_channel()),
|
||||
intval(TERM_SAVEDSEARCH)
|
||||
);
|
||||
|
|
|
@ -3372,7 +3372,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
|
|||
}
|
||||
}
|
||||
if(! $found) {
|
||||
$r = q("INSERT INTO `groups` ( hash, uid, visible, deleted, gname )
|
||||
$r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname )
|
||||
VALUES( '%s', %d, %d, %d, '%s' ) ",
|
||||
dbesc($cl['collection']),
|
||||
intval($channel['channel_id']),
|
||||
|
@ -3446,7 +3446,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
|
|||
// if somebody is in the group that wasn't before - add them
|
||||
|
||||
if(! $found) {
|
||||
q("INSERT INTO `group_member` (`uid`, `gid`, `xchan`)
|
||||
q("INSERT INTO group_member (uid, gid, xchan)
|
||||
VALUES( %d, %d, '%s' ) ",
|
||||
intval($channel['channel_id']),
|
||||
intval($y['id']),
|
||||
|
|
Loading…
Reference in a new issue