From e7233c0c94d0464994df94d8907518d49fcb0650 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 9 Oct 2016 16:31:04 -0700 Subject: more backquotes - this should take care of most except for the array import queries --- Zotlabs/Module/Admin/Accounts.php | 7 +++---- Zotlabs/Module/Admin/Dbsync.php | 2 +- Zotlabs/Module/Connedit.php | 2 +- Zotlabs/Module/Contactgroup.php | 2 +- Zotlabs/Module/Cover_photo.php | 2 +- Zotlabs/Module/Dirsearch.php | 2 +- Zotlabs/Module/Editblock.php | 2 +- Zotlabs/Module/Editlayout.php | 2 +- Zotlabs/Module/Editpost.php | 2 +- Zotlabs/Module/Editwebpage.php | 2 +- Zotlabs/Module/Fbrowser.php | 12 ++++++------ Zotlabs/Module/Invite.php | 2 +- Zotlabs/Module/Match.php | 2 +- Zotlabs/Module/Network.php | 2 +- Zotlabs/Module/Photo.php | 2 +- Zotlabs/Module/Profile_photo.php | 2 +- Zotlabs/Module/Profperm.php | 2 +- Zotlabs/Module/Settings/Channel.php | 2 +- Zotlabs/Module/Settings/Featured.php | 2 +- Zotlabs/Module/Tasks.php | 2 +- 20 files changed, 27 insertions(+), 28 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 143d00a3b..2043550fc 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -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']), diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php index 305126c7d..cff8a2484 100644 --- a/Zotlabs/Module/Admin/Dbsync.php +++ b/Zotlabs/Module/Admin/Dbsync.php @@ -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)); diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 43feac189..c11d1ea16 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -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()) ); diff --git a/Zotlabs/Module/Contactgroup.php b/Zotlabs/Module/Contactgroup.php index bbe56b4ad..2ba53517f 100644 --- a/Zotlabs/Module/Contactgroup.php +++ b/Zotlabs/Module/Contactgroup.php @@ -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()) ); diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 886958b37..7c8e1323c 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -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()) diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index ebd6c3715..927800bbb 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -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']; } diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php index 6a9fa5f2d..654e2251d 100644 --- a/Zotlabs/Module/Editblock.php +++ b/Zotlabs/Module/Editblock.php @@ -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) ); diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php index 26732dc77..ea637fcba 100644 --- a/Zotlabs/Module/Editlayout.php +++ b/Zotlabs/Module/Editlayout.php @@ -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) ); diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php index 838fe9e4f..2c57cde5a 100644 --- a/Zotlabs/Module/Editpost.php +++ b/Zotlabs/Module/Editpost.php @@ -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()) diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index 2da8871a2..3d4af107d 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -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) ); diff --git a/Zotlabs/Module/Fbrowser.php b/Zotlabs/Module/Fbrowser.php index c534e8f72..3bac81c5a 100644 --- a/Zotlabs/Module/Fbrowser.php +++ b/Zotlabs/Module/Fbrowser.php @@ -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()) ); diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php index 5198b1231..6b6f80a31 100644 --- a/Zotlabs/Module/Invite.php +++ b/Zotlabs/Module/Invite.php @@ -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()) ); diff --git a/Zotlabs/Module/Match.php b/Zotlabs/Module/Match.php index c422e4b3e..63bdb60a4 100644 --- a/Zotlabs/Module/Match.php +++ b/Zotlabs/Module/Match.php @@ -25,7 +25,7 @@ class Match extends \Zotlabs\Web\Controller { $o .= '

' . t('Profile Match') . '

'; - $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)) diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 4f831c050..99573ad69 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -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 = ''; diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 4332fd6e9..1134f4275 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -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) ); diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index f459f7deb..1ae3a0a75 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -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']), diff --git a/Zotlabs/Module/Profperm.php b/Zotlabs/Module/Profperm.php index b1da147c1..99cd4c58f 100644 --- a/Zotlabs/Module/Profperm.php +++ b/Zotlabs/Module/Profperm.php @@ -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()) ); diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index a7d8b883f..af640d75d 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -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)) diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 7d7b1a734..eec5f6c02 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -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'); diff --git a/Zotlabs/Module/Tasks.php b/Zotlabs/Module/Tasks.php index 6d0a92d91..c8deb11bf 100644 --- a/Zotlabs/Module/Tasks.php +++ b/Zotlabs/Module/Tasks.php @@ -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)) ); -- cgit v1.2.3