[ticket/11103] Coding guidelines (SQL Queries)

PHPBB3-11103
This commit is contained in:
Nathan Guse 2012-09-09 17:23:32 -05:00
parent 5502f3c4aa
commit 2c31e82b60
2 changed files with 8 additions and 4 deletions

View file

@ -66,7 +66,8 @@ class phpbb_notifications_service
$notifications = $user_ids = array();
$sql = 'SELECT * FROM ' . NOTIFICATIONS_TABLE . '
$sql = 'SELECT *
FROM ' . NOTIFICATIONS_TABLE . '
WHERE user_id = ' . (int) $options['user_id'] . '
ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
@ -116,7 +117,8 @@ class phpbb_notifications_service
// Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item
$sql = 'SELECT user_id FROM ' . NOTIFICATIONS_TABLE . "
$sql = 'SELECT user_id
FROM ' . NOTIFICATIONS_TABLE . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
AND item_id = " . (int) $item_id;
$result = $this->db->sql_query($sql);
@ -239,7 +241,8 @@ class phpbb_notifications_service
if (sizeof($user_ids))
{
$sql = 'SELECT * FROM ' . USERS_TABLE . '
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $this->db->sql_in_set('user_id', $user_ids);
$result = $this->db->sql_query($sql);

View file

@ -183,7 +183,8 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
$rowset = array();
$sql = 'SELECT * FROM ' . USER_NOTIFICATIONS_TABLE . "
$sql = 'SELECT *
FROM ' . USER_NOTIFICATIONS_TABLE . "
WHERE item_type = '" . static::get_item_type() . "'
AND item_id = " . (int) $item_id;
$result = $db->sql_query($sql);