From bad5057a7414eba7f7133538dd671a1413be00e3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 3 Oct 2016 19:47:36 -0700 Subject: start removing db backticks --- Zotlabs/Daemon/Notifier.php | 2 +- Zotlabs/Extend/Hook.php | 10 +++++----- Zotlabs/Lib/Enotify.php | 2 +- Zotlabs/Module/Acl.php | 6 +++--- Zotlabs/Module/Admin.php | 4 ++-- Zotlabs/Module/Cal.php | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index c0997138e..441997db9 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -120,7 +120,7 @@ class Notifier { $normal_mode = false; $mail = true; $private = true; - $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", + $message = q("SELECT * FROM mail WHERE id = %d LIMIT 1", intval($item_id) ); if(! $message) { diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php index fc1e95367..fef3ebe9b 100644 --- a/Zotlabs/Extend/Hook.php +++ b/Zotlabs/Extend/Hook.php @@ -10,7 +10,7 @@ class Hook { $function = serialize($function); } - $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d LIMIT 1", + $r = q("SELECT * FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s' and priority = %d and hook_version = %d LIMIT 1", dbesc($hook), dbesc($file), dbesc($function), @@ -23,13 +23,13 @@ class Hook { // To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except // for priority or hook_version - $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `fn` = '%s'", + $r = q("DELETE FROM hook where hook = '%s' and file = '%s' and fn = '%s'", dbesc($hook), dbesc($file), dbesc($function) ); - $r = q("INSERT INTO `hook` (`hook`, `file`, `fn`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", + $r = q("INSERT INTO hook (hook, file, fn, priority, hook_version) VALUES ( '%s', '%s', '%s', %d, %d )", dbesc($hook), dbesc($file), dbesc($function), @@ -44,7 +44,7 @@ class Hook { if(is_array($function)) { $function = serialize($function); } - $r = q("DELETE FROM hook WHERE hook = '%s' AND `file` = '%s' AND `fn` = '%s' and priority = %d and hook_version = %d", + $r = q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND fn = '%s' and priority = %d and hook_version = %d", dbesc($hook), dbesc($file), dbesc($function), @@ -60,7 +60,7 @@ class Hook { static public function unregister_by_file($file) { - $r = q("DELETE FROM hook WHERE `file` = '%s' ", + $r = q("DELETE FROM hook WHERE file = '%s' ", dbesc($file) ); diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 9a8628968..ccb014255 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -364,7 +364,7 @@ class Enotify { do { $dups = false; $hash = random_string(); - $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", + $r = q("SELECT id FROM notify WHERE hash = '%s' LIMIT 1", dbesc($hash)); if ($r) $dups = true; diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 1acd8e320..29c1e5280 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -77,7 +77,7 @@ class Acl extends \Zotlabs\Web\Controller { if($search) { - $sql_extra = " AND `name` LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; + $sql_extra = " AND groups.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; $sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc($search) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") "; // This horrible mess is needed because position also returns 0 if nothing is found. @@ -105,9 +105,9 @@ class Acl extends \Zotlabs\Web\Controller { if($type == '' || $type == 'g') { $r = q("SELECT groups.id, groups.hash, groups.gname - FROM groups,group_member + FROM groups, group_member WHERE groups.deleted = 0 AND groups.uid = %d - AND group_member.gid=groups.id + AND group_member.gid = groups.id $sql_extra GROUP BY groups.id ORDER BY groups.gname diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index e3702992f..3ffbdd7fa 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -101,8 +101,8 @@ class Admin extends \Zotlabs\Web\Controller { } // pending registrations - $r = q("SELECT COUNT(id) AS `count` FROM `register` WHERE `uid` != '0'"); - $pending = $r[0]['count']; + $r = q("SELECT COUNT(id) AS rtotal FROM register WHERE uid != '0'"); + $pending = $r[0]['rtotal']; // available channels, primary and clones $channels = array(); diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index fd4169e68..0d1641efe 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -109,7 +109,7 @@ class Cal extends \Zotlabs\Web\Controller { /* edit/create form */ if($event_id) { - $r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1", + $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", dbesc($event_id), intval($channel['channel_id']) ); -- cgit v1.2.3