diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/channel.php | 4 | ||||
-rw-r--r-- | include/connections.php | 20 | ||||
-rw-r--r-- | include/conversation.php | 4 | ||||
-rwxr-xr-x | include/items.php | 28 | ||||
-rw-r--r-- | include/message.php | 4 | ||||
-rw-r--r-- | include/security.php | 2 | ||||
-rw-r--r-- | include/selectors.php | 2 | ||||
-rw-r--r-- | include/statistics_fns.php | 2 | ||||
-rw-r--r-- | include/widgets.php | 8 | ||||
-rw-r--r-- | include/zot.php | 4 |
10 files changed, 39 insertions, 39 deletions
diff --git a/include/channel.php b/include/channel.php index 189748d09..4dd356785 100644 --- a/include/channel.php +++ b/include/channel.php @@ -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) diff --git a/include/connections.php b/include/connections.php index 017117dda..b08d046b3 100644 --- a/include/connections.php +++ b/include/connections.php @@ -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 diff --git a/include/conversation.php b/include/conversation.php index 287dd4983..7239e603b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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]; diff --git a/include/items.php b/include/items.php index c62d53c3e..333795827 100755 --- a/include/items.php +++ b/include/items.php @@ -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) ); diff --git a/include/message.php b/include/message.php index 748689206..25986092d 100644 --- a/include/message.php +++ b/include/message.php @@ -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) ); diff --git a/include/security.php b/include/security.php index 9b508d339..5ffa48d9e 100644 --- a/include/security.php +++ b/include/security.php @@ -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) { diff --git a/include/selectors.php b/include/selectors.php index d7d070d31..ab049fff6 100644 --- a/include/selectors.php +++ b/include/selectors.php @@ -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) { diff --git a/include/statistics_fns.php b/include/statistics_fns.php index ce2eee5e7..cbff3b0b7 100644 --- a/include/statistics_fns.php +++ b/include/statistics_fns.php @@ -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); diff --git a/include/widgets.php b/include/widgets.php index 2e1e58717..3396a92a5 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -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) ); diff --git a/include/zot.php b/include/zot.php index f5b7a383e..a214a1b0c 100644 --- a/include/zot.php +++ b/include/zot.php @@ -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']), |