mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 01:06:48 +02:00
$db-> to phpbb::$db->
git-svn-id: file:///svn/phpbb/trunk@9336 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -295,11 +295,11 @@ class acm
|
||||
$this->sql_rowset[$query_id] = array();
|
||||
$this->sql_row_pointer[$query_id] = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($query_result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($query_result))
|
||||
{
|
||||
$this->sql_rowset[$query_id][] = $row;
|
||||
}
|
||||
$db->sql_freeresult($query_result);
|
||||
phpbb::$db->sql_freeresult($query_result);
|
||||
|
||||
apc_store('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl);
|
||||
|
||||
|
@@ -273,11 +273,11 @@ class acm
|
||||
$this->sql_rowset[$query_id] = array();
|
||||
$this->sql_row_pointer[$query_id] = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($query_result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($query_result))
|
||||
{
|
||||
$this->sql_rowset[$query_id][] = $row;
|
||||
}
|
||||
$db->sql_freeresult($query_result);
|
||||
phpbb::$db->sql_freeresult($query_result);
|
||||
|
||||
eaccelerator_put('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl);
|
||||
|
||||
|
@@ -299,11 +299,11 @@ class acm
|
||||
$this->sql_rowset[$query_id] = array();
|
||||
$this->sql_row_pointer[$query_id] = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($query_result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($query_result))
|
||||
{
|
||||
$this->sql_rowset[$query_id][] = $row;
|
||||
}
|
||||
$db->sql_freeresult($query_result);
|
||||
phpbb::$db->sql_freeresult($query_result);
|
||||
|
||||
memcache_set($this->memcache, 'sql_' . md5($query), $this->sql_rowset[$query_id], 0, $ttl);
|
||||
|
||||
|
@@ -257,11 +257,11 @@ class acm
|
||||
$this->sql_rowset[$query_id] = array();
|
||||
$this->sql_row_pointer[$query_id] = 0;
|
||||
|
||||
while ($row = $db->sql_fetchrow($query_result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($query_result))
|
||||
{
|
||||
$this->sql_rowset[$query_id][] = $row;
|
||||
}
|
||||
$db->sql_freeresult($query_result);
|
||||
phpbb::$db->sql_freeresult($query_result);
|
||||
|
||||
xcache_set('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl);
|
||||
|
||||
|
@@ -84,10 +84,10 @@ function login_apache(&$username, &$password)
|
||||
|
||||
$sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE username = '" . $db->sql_escape($php_auth_user) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
WHERE username = '" . phpbb::$db->sql_escape($php_auth_user) . "'";
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
@@ -147,10 +147,10 @@ function autologin_apache()
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE username = '" . $db->sql_escape($php_auth_user) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
WHERE username = '" . phpbb::$db->sql_escape($php_auth_user) . "'";
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
@@ -167,10 +167,10 @@ function autologin_apache()
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($php_auth_user)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
WHERE username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($php_auth_user)) . "'";
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
@@ -189,11 +189,11 @@ function user_row_apache($username, $password)
|
||||
// first retrieve default group id
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name_clean = '" . $db->sql_escape('registered') . "'
|
||||
WHERE group_name_clean = '" . phpbb::$db->sql_escape('registered') . "'
|
||||
AND group_type = " . GROUP_SPECIAL;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
|
@@ -173,10 +173,10 @@ function login_ldap(&$username, &$password)
|
||||
|
||||
$sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type
|
||||
FROM ' . USERS_TABLE . "
|
||||
WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
WHERE username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
@@ -204,11 +204,11 @@ function login_ldap(&$username, &$password)
|
||||
// retrieve default group id
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name_clean = '" . $db->sql_escape('registered') . "'
|
||||
WHERE group_name_clean = '" . phpbb::$db->sql_escape('registered') . "'
|
||||
AND group_type = " . GROUP_SPECIAL;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
|
@@ -163,10 +163,10 @@ class bbcode
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('bbcode_id', $sql);
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
WHERE ' . phpbb::$db->sql_in_set('bbcode_id', $sql);
|
||||
$result = phpbb::$db->sql_query($sql, 3600);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
// To circumvent replacing newlines with <br /> for the generated html,
|
||||
// we use carriage returns here. They are later changed back to newlines
|
||||
@@ -175,7 +175,7 @@ class bbcode
|
||||
|
||||
$rowset[$row['bbcode_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($bbcode_ids as $bbcode_id)
|
||||
|
@@ -118,25 +118,25 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
|
||||
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id)
|
||||
WHERE s.session_id IS NULL' .
|
||||
((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type);
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
if ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$sql_in = array();
|
||||
do
|
||||
{
|
||||
$sql_in[] = (string) $row['session_id'];
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
while ($row = phpbb::$db->sql_fetchrow($result));
|
||||
|
||||
if (sizeof($sql_in))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . CONFIRM_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('session_id', $sql_in);
|
||||
$db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('session_id', $sql_in);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
@@ -195,14 +195,14 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
|
||||
// compute $seed % 0x7fffffff
|
||||
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
|
||||
|
||||
$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array(
|
||||
'confirm_id' => (string) $this->confirm_id,
|
||||
'session_id' => (string) phpbb::$user->session_id,
|
||||
'confirm_type' => (int) $this->type,
|
||||
'code' => (string) $this->code,
|
||||
'seed' => (int) $this->seed)
|
||||
);
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,12 +212,12 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
|
||||
{
|
||||
$sql = 'SELECT code, seed
|
||||
FROM ' . CONFIRM_TABLE . "
|
||||
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
|
||||
AND session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "'
|
||||
WHERE confirm_id = '" . phpbb::$db->sql_escape($this->confirm_id) . "'
|
||||
AND session_id = '" . phpbb::$db->sql_escape(phpbb::$user->session_id) . "'
|
||||
AND confirm_type = " . $this->type;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
if ($row)
|
||||
{
|
||||
$this->code = $row['code'];
|
||||
@@ -243,21 +243,21 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
|
||||
protected function delete_code()
|
||||
{
|
||||
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
|
||||
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
|
||||
AND session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "'
|
||||
WHERE confirm_id = '" . phpbb::$db->sql_escape($this->confirm_id) . "'
|
||||
AND session_id = '" . phpbb::$db->sql_escape(phpbb::$user->session_id) . "'
|
||||
AND confirm_type = " . $this->type;
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
function get_attempt_count()
|
||||
{
|
||||
$sql = 'SELECT COUNT(session_id) AS attempts
|
||||
FROM ' . CONFIRM_TABLE . "
|
||||
WHERE session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "'
|
||||
WHERE session_id = '" . phpbb::$db->sql_escape(phpbb::$user->session_id) . "'
|
||||
AND confirm_type = " . $this->type;
|
||||
$result = $db->sql_query($sql);
|
||||
$attempts = (int) $db->sql_fetchfield('attempts');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$attempts = (int) phpbb::$db->sql_fetchfield('attempts');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
return $attempts;
|
||||
}
|
||||
@@ -266,9 +266,9 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
|
||||
function reset()
|
||||
{
|
||||
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
|
||||
WHERE session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "'
|
||||
WHERE session_id = '" . phpbb::$db->sql_escape(phpbb::$user->session_id) . "'
|
||||
AND confirm_type = " . (int) $this->type;
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
// we leave the class usable by generating a new question
|
||||
$this->generate_code();
|
||||
|
@@ -364,7 +364,7 @@ abstract class phpbb_dbal
|
||||
if ($type === 'UPDATE')
|
||||
{
|
||||
$where = ($where) ? ' WHERE ' . $where : '';
|
||||
$this->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', $data) . $where);
|
||||
$this->sql_query('UPDATE ' . $table . ' SET ' . $this->sql_build_array('UPDATE', $data) . $where);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -150,9 +150,9 @@ class formatted_text
|
||||
{
|
||||
$this->changed = false;
|
||||
|
||||
$sql = 'UPDATE ' . $table . ' SET ' . $db->sql_build_query('UPDATE', $this->to_db_data($column))
|
||||
. ' WHERE ' . $where;
|
||||
return (bool) $db->sql_query($sql);
|
||||
$sql = 'UPDATE ' . $table . ' SET ' . phpbb::$db->sql_build_query('UPDATE', $this->to_db_data($column))
|
||||
. ' WHERE ' . $where;
|
||||
return (bool) phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -79,7 +79,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||
{
|
||||
$sql_array['LEFT_JOIN'][] = array(
|
||||
'FROM' => array(FORUMS_ACCESS_TABLE => 'fa'),
|
||||
'ON' => "fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape(phpbb::$user->session_id) . "'"
|
||||
'ON' => "fa.forum_id = f.forum_id AND fa.session_id = '" . phpbb::$db->sql_escape(phpbb::$user->session_id) . "'"
|
||||
);
|
||||
|
||||
$sql_array['SELECT'] .= ', fa.user_id';
|
||||
@@ -573,20 +573,20 @@ function get_forum_parents(&$forum_data)
|
||||
WHERE left_id < ' . $forum_data['left_id'] . '
|
||||
AND right_id > ' . $forum_data['right_id'] . '
|
||||
ORDER BY left_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$forum_parents[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$forum_data['forum_parents'] = serialize($forum_parents);
|
||||
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . "
|
||||
SET forum_parents = '" . $db->sql_escape($forum_data['forum_parents']) . "'
|
||||
SET forum_parents = '" . phpbb::$db->sql_escape($forum_data['forum_parents']) . "'
|
||||
WHERE parent_id = " . $forum_data['parent_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -833,10 +833,10 @@ function display_custom_bbcodes()
|
||||
FROM ' . BBCODES_TABLE . '
|
||||
WHERE display_on_posting = 1
|
||||
ORDER BY bbcode_tag';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$i = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('custom_tags', array(
|
||||
'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'",
|
||||
@@ -848,7 +848,7 @@ function display_custom_bbcodes()
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -859,9 +859,9 @@ function display_reasons($reason_id = 0)
|
||||
$sql = 'SELECT *
|
||||
FROM ' . REPORTS_REASONS_TABLE . '
|
||||
ORDER BY reason_order ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
|
||||
if (isset(phpbb::$user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset(phpbb::$user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
|
||||
@@ -877,7 +877,7 @@ function display_reasons($reason_id = 0)
|
||||
'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -905,7 +905,7 @@ function display_user_activity(&$userdata)
|
||||
}
|
||||
|
||||
$forum_ary = array_unique($forum_ary);
|
||||
$forum_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary, true) : '';
|
||||
$forum_sql = (sizeof($forum_ary)) ? 'AND ' . phpbb::$db->sql_in_set('forum_id', $forum_ary, true) : '';
|
||||
|
||||
// Obtain active forum
|
||||
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
||||
@@ -915,18 +915,18 @@ function display_user_activity(&$userdata)
|
||||
$forum_sql
|
||||
GROUP BY forum_id
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$active_f_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$active_f_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!empty($active_f_row))
|
||||
{
|
||||
$sql = 'SELECT forum_name
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . $active_f_row['forum_id'];
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql, 3600);
|
||||
$active_f_row['forum_name'] = (string) phpbb::$db->sql_fetchfield('forum_name');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Obtain active topic
|
||||
@@ -937,18 +937,18 @@ function display_user_activity(&$userdata)
|
||||
$forum_sql
|
||||
GROUP BY topic_id
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$active_t_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$active_t_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!empty($active_t_row))
|
||||
{
|
||||
$sql = 'SELECT topic_title
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_id = ' . $active_t_row['topic_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$active_t_row['topic_title'] = (string) phpbb::$db->sql_fetchfield('topic_title');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$userdata['active_t_row'] = $active_t_row;
|
||||
@@ -1011,10 +1011,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||
FROM $table_sql
|
||||
WHERE $where_sql = $match_id
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$notify_status = ($row = $db->sql_fetchrow($result)) ? $row['notify_status'] : NULL;
|
||||
$db->sql_freeresult($result);
|
||||
$notify_status = ($row = phpbb::$db->sql_fetchrow($result)) ? $row['notify_status'] : NULL;
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!is_null($notify_status) && $notify_status !== '')
|
||||
@@ -1036,7 +1036,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||
$sql = 'DELETE FROM ' . $table_sql . "
|
||||
WHERE $where_sql = $match_id
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$redirect_url = phpbb::$url->append_sid("view$mode", "$u_url=$match_id&start=$start");
|
||||
@@ -1056,7 +1056,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||
SET notify_status = 0
|
||||
WHERE $where_sql = $match_id
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1073,7 +1073,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||
|
||||
$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
|
||||
VALUES ($user_id, $match_id, 0)";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
$message = phpbb::$user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||
}
|
||||
else
|
||||
|
@@ -28,9 +28,9 @@ function generate_smilies($mode, $forum_id)
|
||||
$sql = 'SELECT forum_style
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
phpbb::$user->setup('posting', (int) $row['forum_style']);
|
||||
}
|
||||
@@ -52,13 +52,13 @@ function generate_smilies($mode, $forum_id)
|
||||
$sql = 'SELECT smiley_id
|
||||
FROM ' . SMILIES_TABLE . '
|
||||
WHERE display_on_posting = 0';
|
||||
$result = $db->sql_query_limit($sql, 1, 0, 3600);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1, 0, 3600);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
if ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$display_link = true;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$last_url = '';
|
||||
@@ -67,17 +67,17 @@ function generate_smilies($mode, $forum_id)
|
||||
FROM ' . SMILIES_TABLE .
|
||||
(($mode == 'inline') ? ' WHERE display_on_posting = 1 ' : '') . '
|
||||
ORDER BY smiley_order';
|
||||
$result = $db->sql_query($sql, 3600);
|
||||
$result = phpbb::$db->sql_query($sql, 3600);
|
||||
|
||||
$smilies = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (empty($smilies[$row['smiley_url']]))
|
||||
{
|
||||
$smilies[$row['smiley_url']] = $row;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($smilies))
|
||||
{
|
||||
@@ -145,7 +145,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
{
|
||||
$sql = 'SELECT MAX(p.post_id) as last_post_id
|
||||
FROM ' . POSTS_TABLE . " p $topic_join
|
||||
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
|
||||
WHERE " . phpbb::$db->sql_in_set('p.' . $type . '_id', $ids) . "
|
||||
$topic_condition
|
||||
AND p.post_approved = 1";
|
||||
}
|
||||
@@ -153,15 +153,15 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
{
|
||||
$sql = 'SELECT p.' . $type . '_id, MAX(p.post_id) as last_post_id
|
||||
FROM ' . POSTS_TABLE . " p $topic_join
|
||||
WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . "
|
||||
WHERE " . phpbb::$db->sql_in_set('p.' . $type . '_id', $ids) . "
|
||||
$topic_condition
|
||||
AND p.post_approved = 1
|
||||
GROUP BY p.{$type}_id";
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$last_post_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (sizeof($ids) == 1)
|
||||
{
|
||||
@@ -180,7 +180,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
|
||||
$last_post_ids[] = $row['last_post_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($type == 'forum')
|
||||
{
|
||||
@@ -202,19 +202,19 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
$sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND ' . $db->sql_in_set('p.post_id', $last_post_ids);
|
||||
$result = $db->sql_query($sql);
|
||||
AND ' . phpbb::$db->sql_in_set('p.post_id', $last_post_ids);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id'];
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . phpbb::$db->sql_escape($row['post_subject']) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time'];
|
||||
$update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id'];
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? phpbb::$db->sql_escape($row['post_username']) : phpbb::$db->sql_escape($row['username'])) . "'";
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
unset($empty_forums, $ids, $last_post_ids);
|
||||
|
||||
@@ -230,7 +230,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
$sql = "UPDATE $table
|
||||
SET " . implode(', ', $update_sql_ary) . "
|
||||
WHERE {$type}_id = $update_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -823,9 +823,9 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||
WHERE d.user_id = ' . phpbb::$user->data['user_id'] . "
|
||||
$sql_and
|
||||
ORDER BY d.save_time DESC";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_id'])
|
||||
{
|
||||
@@ -833,7 +833,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||
}
|
||||
$draft_rows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($draft_rows))
|
||||
{
|
||||
@@ -845,14 +845,14 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||
{
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('topic_id', array_unique($topic_ids));
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_rows[$row['topic_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
unset($topic_ids);
|
||||
|
||||
@@ -924,23 +924,22 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
|
||||
ORDER BY p.post_time ';
|
||||
$sql .= ($mode == 'post_review') ? 'ASC' : 'DESC';
|
||||
$result = $db->sql_query_limit($sql, phpbb::$config['posts_per_page']);
|
||||
$result = phpbb::$db->sql_query_limit($sql, phpbb::$config['posts_per_page']);
|
||||
|
||||
$post_list = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$post_list[] = $row['post_id'];
|
||||
}
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($post_list))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', array(
|
||||
$sql = phpbb::$db->sql_build_query('SELECT', array(
|
||||
'SELECT' => 'u.username, u.user_id, u.user_colour, p.*',
|
||||
|
||||
'FROM' => array(
|
||||
@@ -948,16 +947,16 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||
POSTS_TABLE => 'p',
|
||||
),
|
||||
|
||||
'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
|
||||
'WHERE' => phpbb::$db->sql_in_set('p.post_id', $post_list) . '
|
||||
AND u.user_id = p.poster_id'
|
||||
));
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$bbcode_bitfield = '';
|
||||
$rowset = array();
|
||||
$has_attachments = false;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$rowset[$row['post_id']] = $row;
|
||||
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
|
||||
@@ -967,7 +966,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||
$has_attachments = true;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// Instantiate BBCode class
|
||||
if (!isset($bbcode) && $bbcode_bitfield !== '')
|
||||
@@ -985,16 +984,16 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||
// Get attachments...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('post_msg_id', $post_list) . '
|
||||
AND in_message = 0
|
||||
ORDER BY filetime DESC, post_msg_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$attachments[$row['post_msg_id']][] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||
@@ -1105,14 +1104,14 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
FROM ' . BANLIST_TABLE . '
|
||||
WHERE ban_userid <> 0
|
||||
AND ban_exclude <> 1';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$sql_ignore_users = ANONYMOUS . ', ' . phpbb::$user->data['user_id'];
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$sql_ignore_users .= ', ' . (int) $row['ban_userid'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$notify_rows = array();
|
||||
|
||||
@@ -1124,9 +1123,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
AND w.notify_status = 0
|
||||
AND u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||
AND u.user_id = w.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$notify_rows[$row['user_id']] = array(
|
||||
'user_id' => $row['user_id'],
|
||||
@@ -1140,7 +1139,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
'allowed' => false
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// forum notification is sent to those not already receiving topic notifications
|
||||
if ($topic_notification)
|
||||
@@ -1157,9 +1156,9 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
AND fw.notify_status = 0
|
||||
AND u.user_type IN (" . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')
|
||||
AND u.user_id = fw.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$notify_rows[$row['user_id']] = array(
|
||||
'user_id' => $row['user_id'],
|
||||
@@ -1173,7 +1172,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
'allowed' => false
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!sizeof($notify_rows))
|
||||
@@ -1260,15 +1259,15 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
}
|
||||
|
||||
// Handle the DB updates
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
if (!empty($update_notification['topic']))
|
||||
{
|
||||
$sql = 'UPDATE ' . TOPICS_WATCH_TABLE . "
|
||||
SET notify_status = 1
|
||||
WHERE topic_id = $topic_id
|
||||
AND " . $db->sql_in_set('user_id', $update_notification['topic']);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('user_id', $update_notification['topic']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if (!empty($update_notification['forum']))
|
||||
@@ -1276,8 +1275,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
$sql = 'UPDATE ' . FORUMS_WATCH_TABLE . "
|
||||
SET notify_status = 1
|
||||
WHERE forum_id = $forum_id
|
||||
AND " . $db->sql_in_set('user_id', $update_notification['forum']);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('user_id', $update_notification['forum']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Now delete the user_ids not authorised to receive notifications on this topic/forum
|
||||
@@ -1285,19 +1284,19 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||
{
|
||||
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . "
|
||||
WHERE topic_id = $topic_id
|
||||
AND " . $db->sql_in_set('user_id', $delete_ids['topic']);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('user_id', $delete_ids['topic']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if (!empty($delete_ids['forum']))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . "
|
||||
WHERE forum_id = $forum_id
|
||||
AND " . $db->sql_in_set('user_id', $delete_ids['forum']);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('user_id', $delete_ids['forum']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1328,7 +1327,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
|
||||
include_once(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
// we must make sure to update forums that contain the shadow'd topic
|
||||
if ($post_mode == 'delete_topic')
|
||||
@@ -1337,9 +1336,9 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_id);
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
WHERE ' . phpbb::$db->sql_in_set('topic_moved_id', $topic_id);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($shadow_forum_ids[(int) $row['forum_id']]))
|
||||
{
|
||||
@@ -1350,7 +1349,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
$shadow_forum_ids[(int) $row['forum_id']]++;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!delete_posts('post_id', array($post_id), false, false))
|
||||
@@ -1363,7 +1362,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
trigger_error('ALREADY_DELETED');
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
|
||||
// Collect the necessary information for updating the tables
|
||||
$sql_data[FORUMS_TABLE] = '';
|
||||
@@ -1375,7 +1374,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
{
|
||||
// counting is fun! we only have to do sizeof($forum_ids) number of queries,
|
||||
// even if the topic is moved back to where its shadow lives (we count how many times it is in a forum)
|
||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_topics_real = forum_topics_real - ' . $topic_count . ', forum_topics = forum_topics - ' . $topic_count . ' WHERE forum_id = ' . $updated_forum);
|
||||
phpbb::$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_topics_real = forum_topics_real - ' . $topic_count . ', forum_topics = forum_topics - ' . $topic_count . ' WHERE forum_id = ' . $updated_forum);
|
||||
update_post_information('forum', $updated_forum);
|
||||
}
|
||||
|
||||
@@ -1401,16 +1400,16 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
WHERE p.topic_id = $topic_id
|
||||
AND p.poster_id = u.user_id
|
||||
ORDER BY p.post_time ASC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($data['topic_type'] != POST_GLOBAL)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
|
||||
}
|
||||
|
||||
$sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
|
||||
$sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? phpbb::$db->sql_escape($row['post_username']) : phpbb::$db->sql_escape($row['username'])) . "'";
|
||||
|
||||
// Decrementing topic_replies here is fine because this case only happens if there is more than one post within the topic - basically removing one "reply"
|
||||
$sql_data[TOPICS_TABLE] .= ', topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
|
||||
@@ -1445,9 +1444,9 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE topic_id = $topic_id " .
|
||||
((!phpbb::$acl->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '');
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$next_post_id = (int) $row['last_post_id'];
|
||||
}
|
||||
@@ -1460,9 +1459,9 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
((!phpbb::$acl->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '') . '
|
||||
AND post_time > ' . $data['post_time'] . '
|
||||
ORDER BY post_time ASC';
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($data['topic_type'] != POST_GLOBAL)
|
||||
{
|
||||
@@ -1476,7 +1475,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
|
||||
// $sql_data[USERS_TABLE] = ($data['post_postcount']) ? 'user_posts = user_posts - 1' : '';
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
$where_sql = array(
|
||||
FORUMS_TABLE => "forum_id = $forum_id",
|
||||
@@ -1488,7 +1487,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
{
|
||||
if ($update_sql)
|
||||
{
|
||||
$db->sql_query("UPDATE $table SET $update_sql WHERE " . $where_sql[$table]);
|
||||
phpbb::$db->sql_query("UPDATE $table SET $update_sql WHERE " . $where_sql[$table]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1499,9 +1498,9 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE topic_id = ' . $topic_id . '
|
||||
AND poster_id = ' . $data['poster_id'];
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$poster_id = (int) $db->sql_fetchfield('poster_id');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query_limit($sql, 1);
|
||||
$poster_id = (int) phpbb::$db->sql_fetchfield('poster_id');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// The user is not having any more posts within this topic
|
||||
if (!$poster_id)
|
||||
@@ -1509,11 +1508,11 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
|
||||
$sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
|
||||
WHERE topic_id = ' . $topic_id . '
|
||||
AND user_id = ' . $data['poster_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
|
||||
if ($data['post_reported'] && ($post_mode != 'delete_topic'))
|
||||
{
|
||||
@@ -1567,9 +1566,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||
WHERE t.topic_id = p.topic_id
|
||||
AND p.post_id = ' . $data['post_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$topic_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$topic_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$data['topic_approved'] = $topic_row['topic_approved'];
|
||||
$data['post_approved'] = $topic_row['post_approved'];
|
||||
@@ -1585,7 +1584,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
}
|
||||
|
||||
// Start the transaction here
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
// Collect Information
|
||||
switch ($post_mode)
|
||||
@@ -1769,9 +1768,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_approved
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_id = ' . $data['topic_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$topic_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$topic_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// If this is the only post remaining we do not need to decrement topic_replies.
|
||||
@@ -1817,10 +1816,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
if ($post_mode == 'post')
|
||||
{
|
||||
$sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' .
|
||||
$db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']);
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
$data['topic_id'] = $db->sql_nextid();
|
||||
$data['topic_id'] = phpbb::$db->sql_nextid();
|
||||
|
||||
$sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array(
|
||||
'topic_id' => $data['topic_id'])
|
||||
@@ -1838,9 +1837,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']);
|
||||
$db->sql_query($sql);
|
||||
$data['post_id'] = $db->sql_nextid();
|
||||
$sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']);
|
||||
phpbb::$db->sql_query($sql);
|
||||
$data['post_id'] = phpbb::$db->sql_nextid();
|
||||
|
||||
if ($post_mode == 'post')
|
||||
{
|
||||
@@ -1868,9 +1867,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_approved, topic_last_post_id
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_id = ' . $data['topic_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$topic_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$topic_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// globalise/unglobalise?
|
||||
@@ -1878,7 +1877,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
if (!empty($sql_data[FORUMS_TABLE]['stat']) && implode('', $sql_data[FORUMS_TABLE]['stat']))
|
||||
{
|
||||
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $sql_data[FORUMS_TABLE]['stat']) . ' WHERE forum_id = ' . $data['forum_id']);
|
||||
phpbb::$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $sql_data[FORUMS_TABLE]['stat']) . ' WHERE forum_id = ' . $data['forum_id']);
|
||||
}
|
||||
|
||||
$make_global = true;
|
||||
@@ -1896,7 +1895,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET forum_id = 0
|
||||
WHERE topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
// unglobalise
|
||||
else if ($topic_row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL)
|
||||
@@ -1909,7 +1908,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET forum_id = ' . $data['forum_id'] . '
|
||||
WHERE topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1917,18 +1916,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
if (isset($sql_data[TOPICS_TABLE]['sql']))
|
||||
{
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . '
|
||||
SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . '
|
||||
WHERE topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Update the posts table
|
||||
if (isset($sql_data[POSTS_TABLE]['sql']))
|
||||
{
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . '
|
||||
SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . '
|
||||
WHERE post_id = ' . $data['post_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Update Poll Tables
|
||||
@@ -1942,14 +1941,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POLL_OPTIONS_TABLE . '
|
||||
WHERE topic_id = ' . $data['topic_id'] . '
|
||||
ORDER BY poll_option_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$cur_poll_options = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$cur_poll_options[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
$sql_insert_ary = array();
|
||||
@@ -1970,29 +1969,29 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
else if ($poll['poll_options'][$i] != $cur_poll_options[$i])
|
||||
{
|
||||
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . "
|
||||
SET poll_option_text = '" . $db->sql_escape($poll['poll_options'][$i]) . "'
|
||||
SET poll_option_text = '" . phpbb::$db->sql_escape($poll['poll_options'][$i]) . "'
|
||||
WHERE poll_option_id = " . $cur_poll_options[$i]['poll_option_id'] . '
|
||||
AND topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);
|
||||
phpbb::$db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);
|
||||
|
||||
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '
|
||||
WHERE poll_option_id > ' . sizeof($poll['poll_options']) . '
|
||||
AND topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option
|
||||
if ($mode == 'edit' && sizeof($poll['poll_options']) != sizeof($cur_poll_options))
|
||||
{
|
||||
$db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data['topic_id']);
|
||||
$db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data['topic_id']);
|
||||
phpbb::$db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data['topic_id']);
|
||||
phpbb::$db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data['topic_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2011,17 +2010,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
$sql = 'SELECT attach_id, filesize, physical_filename
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($orphan_rows)) . '
|
||||
AND is_orphan = 1
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$orphan_rows = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$orphan_rows[$row['attach_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($data['attachment_data'] as $pos => $attach_row)
|
||||
@@ -2035,10 +2034,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
// update entry in db if attachment already stored in db and filespace
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . "
|
||||
SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "'
|
||||
SET attach_comment = '" . phpbb::$db->sql_escape($attach_row['attach_comment']) . "'
|
||||
WHERE attach_id = " . (int) $attach_row['attach_id'] . '
|
||||
AND is_orphan = 0';
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2059,11 +2058,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
'attach_comment' => $attach_row['attach_comment'],
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . '
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $attach_sql) . '
|
||||
WHERE attach_id = ' . $attach_row['attach_id'] . '
|
||||
AND is_orphan = 1
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2088,11 +2087,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
if (($post_mode == 'post' || $post_mode == 'reply') && $post_approved)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . phpbb::$db->sql_escape($subject) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time;
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) phpbb::$user->data['user_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape(phpbb::$user->data['user_colour']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . phpbb::$db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . phpbb::$db->sql_escape(phpbb::$user->data['user_colour']) . "'";
|
||||
}
|
||||
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
|
||||
{
|
||||
@@ -2101,9 +2100,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'SELECT forum_last_post_id, forum_last_post_subject
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . (int) $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// this post is the latest post in the forum, better update
|
||||
if ($row['forum_last_post_id'] == $data['post_id'])
|
||||
@@ -2114,13 +2113,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
// the post's subject changed
|
||||
if ($row['forum_last_post_subject'] !== $subject)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_subject = \'' . $db->sql_escape($subject) . '\'';
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_subject = \'' . phpbb::$db->sql_escape($subject) . '\'';
|
||||
}
|
||||
|
||||
// Update the user name if poster is anonymous... just in case an admin changed it
|
||||
if ($data['poster_id'] == ANONYMOUS)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . phpbb::$db->sql_escape($username) . "'";
|
||||
}
|
||||
}
|
||||
else if ($data['post_approved'] !== $post_approved)
|
||||
@@ -2130,9 +2129,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE forum_id = ' . (int) $data['forum_id'] . '
|
||||
AND topic_approved = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// any posts left in this forum?
|
||||
if (!empty($row['last_post_id']))
|
||||
@@ -2141,17 +2140,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.post_id = ' . (int) $row['last_post_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// salvation, a post is found! jam it into the forums table
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . phpbb::$db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . phpbb::$db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2173,9 +2172,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'SELECT forum_last_post_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . (int) $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$forum_row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// we made a topic global, go get new data
|
||||
if ($topic_row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL && $forum_row['forum_last_post_id'] == $topic_row['topic_last_post_id'])
|
||||
@@ -2185,9 +2184,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE forum_id = ' . (int) $data['forum_id'] . '
|
||||
AND topic_approved = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// any posts left in this forum?
|
||||
if (!empty($row['last_post_id']))
|
||||
@@ -2196,17 +2195,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.post_id = ' . (int) $row['last_post_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// salvation, a post is found! jam it into the forums table
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . phpbb::$db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . phpbb::$db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2226,17 +2225,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.post_id = ' . (int) $topic_row['topic_last_post_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// salvation, a post is found! jam it into the forums table
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . phpbb::$db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . phpbb::$db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2249,20 +2248,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_id = ' . (int) $data['post_id'];
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) phpbb::$user->data['user_id'];
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . ((!phpbb::$user->is_guest) ? $db->sql_escape(phpbb::$user->data['user_colour']) : '') . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . phpbb::$db->sql_escape((!phpbb::$user->is_registered && $username) ? $username : ((!phpbb::$user->is_guest) ? phpbb::$user->data['username'] : '')) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . ((!phpbb::$user->is_guest) ? phpbb::$db->sql_escape(phpbb::$user->data['user_colour']) : '') . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . phpbb::$db->sql_escape($subject) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $current_time;
|
||||
}
|
||||
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
|
||||
{
|
||||
// only the subject can be changed from edit
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . phpbb::$db->sql_escape($subject) . "'";
|
||||
|
||||
// Maybe not only the subject, but also changing anonymous usernames. ;)
|
||||
if ($data['poster_id'] == ANONYMOUS)
|
||||
{
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . phpbb::$db->sql_escape($username) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2273,9 +2272,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE topic_id = ' . (int) $data['topic_id'] . '
|
||||
AND post_approved = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// any posts left in this forum?
|
||||
if (!empty($row['last_post_id']))
|
||||
@@ -2284,17 +2283,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.post_id = ' . (int) $row['last_post_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// salvation, a post is found! jam it into the topics table
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_id = ' . (int) $row['post_id'];
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . phpbb::$db->sql_escape($row['post_subject']) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_post_time = ' . (int) $row['post_time'];
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_poster_id = ' . (int) $row['poster_id'];
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . phpbb::$db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_colour = '" . phpbb::$db->sql_escape($row['user_colour']) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2321,7 +2320,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
if (isset($update_ary['stat']) && implode('', $update_ary['stat']))
|
||||
{
|
||||
$sql = "UPDATE $table SET " . implode(', ', $update_ary['stat']) . ' WHERE ' . $where_sql[$table];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2330,11 +2329,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
|
||||
WHERE topic_moved_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Committing the transaction before updating search index
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
|
||||
// Delete draft if post was loaded...
|
||||
$draft_id = request_var('draft_loaded', 0);
|
||||
@@ -2343,7 +2342,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "
|
||||
WHERE draft_id = $draft_id
|
||||
AND user_id = " . phpbb::$user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Index message contents
|
||||
@@ -2380,14 +2379,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
{
|
||||
$sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id)
|
||||
VALUES (' . phpbb::$user->data['user_id'] . ', ' . $data['topic_id'] . ')';
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
else if ($data['notify_set'] && !$data['notify'])
|
||||
{
|
||||
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
|
||||
WHERE user_id = ' . phpbb::$user->data['user_id'] . '
|
||||
AND topic_id = ' . $data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2408,9 +2407,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
FROM ' . FORUMS_TRACK_TABLE . '
|
||||
WHERE user_id = ' . phpbb::$user->data['user_id'] . '
|
||||
AND forum_id = ' . $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$f_mark_time = (int) phpbb::$db->sql_fetchfield('mark_time');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
else if (phpbb::$config['load_anon_lastread'] || phpbb::$user->is_registered)
|
||||
{
|
||||
@@ -2423,9 +2422,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||
$sql = 'SELECT forum_last_post_time
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_id = ' . $data['forum_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$forum_last_post_time = (int) phpbb::$db->sql_fetchfield('forum_last_post_time');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
|
||||
}
|
||||
|
@@ -123,15 +123,15 @@ function get_folder($user_id, $folder_id = false)
|
||||
WHERE user_id = $user_id
|
||||
AND folder_id <> " . PRIVMSGS_NO_BOX . '
|
||||
GROUP BY folder_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$num_messages = $num_unread = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$num_messages[(int) $row['folder_id']] = $row['num_messages'];
|
||||
$num_unread[(int) $row['folder_id']] = $row['num_unread'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// Make sure the default boxes are defined
|
||||
$available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX);
|
||||
@@ -162,9 +162,9 @@ function get_folder($user_id, $folder_id = false)
|
||||
$sql = 'SELECT folder_id, folder_name, pm_count
|
||||
FROM ' . PRIVMSGS_FOLDER_TABLE . "
|
||||
WHERE user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$folder[$row['folder_id']] = array(
|
||||
'folder_name' => $row['folder_name'],
|
||||
@@ -172,7 +172,7 @@ function get_folder($user_id, $folder_id = false)
|
||||
'unread_messages' => ((isset($num_unread[$row['folder_id']])) ? $num_unread[$row['folder_id']] : 0)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$folder[PRIVMSGS_OUTBOX] = array(
|
||||
'folder_name' => phpbb::$user->lang['PM_OUTBOX'],
|
||||
@@ -229,14 +229,14 @@ function clean_sentbox($num_sentbox_messages)
|
||||
AND t.user_id = ' . phpbb::$user->data['user_id'] . '
|
||||
AND t.folder_id = ' . PRIVMSGS_SENTBOX . '
|
||||
ORDER BY p.message_time ASC';
|
||||
$result = $db->sql_query_limit($sql, ($num_sentbox_messages - phpbb::$user->data['message_limit']));
|
||||
$result = phpbb::$db->sql_query_limit($sql, ($num_sentbox_messages - phpbb::$user->data['message_limit']));
|
||||
|
||||
$delete_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$delete_ids[] = $row['msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
delete_pm(phpbb::$user->data['user_id'], $delete_ids, PRIVMSGS_SENTBOX);
|
||||
}
|
||||
}
|
||||
@@ -286,9 +286,9 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
|
||||
$sql = 'SELECT user_id, user_type, user_permissions
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id = ' . (int) $message_row['author_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$userdata = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$userdata = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$auth2 = new auth();
|
||||
$auth2->acl($userdata);
|
||||
@@ -319,9 +319,9 @@ function update_pm_counts()
|
||||
WHERE pm_unread = 1
|
||||
AND folder_id <> ' . PRIVMSGS_OUTBOX . '
|
||||
AND user_id = ' . phpbb::$user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
phpbb::$user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
phpbb::$user->data['user_unread_privmsg'] = (int) phpbb::$db->sql_fetchfield('num_messages');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// Update new pm count
|
||||
$sql = 'SELECT COUNT(msg_id) as num_messages
|
||||
@@ -329,11 +329,11 @@ function update_pm_counts()
|
||||
WHERE pm_new = 1
|
||||
AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ')
|
||||
AND user_id = ' . phpbb::$user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
phpbb::$user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
phpbb::$user->data['user_new_privmsg'] = (int) phpbb::$db->sql_fetchfield('num_messages');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
||||
phpbb::$db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', array(
|
||||
'user_unread_privmsg' => (int) phpbb::$user->data['user_unread_privmsg'],
|
||||
'user_new_privmsg' => (int) phpbb::$user->data['user_new_privmsg'],
|
||||
)) . ' WHERE user_id = ' . phpbb::$user->data['user_id']);
|
||||
@@ -346,7 +346,7 @@ function update_pm_counts()
|
||||
WHERE pm_new = 1
|
||||
AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ')
|
||||
AND user_id = ' . phpbb::$user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
SET folder_id = ' . PRIVMSGS_NO_BOX . '
|
||||
WHERE folder_id = ' . PRIVMSGS_HOLD_BOX . "
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Get those messages not yet placed into any box
|
||||
@@ -387,13 +387,13 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
// Just place into the appropriate arrays if no rules need to be checked
|
||||
if (!$user_message_rules)
|
||||
{
|
||||
$result = $db->sql_query($retrieve_sql);
|
||||
$result = phpbb::$db->sql_query($retrieve_sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$action_ary[$row['msg_id']][] = array('action' => false);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -404,28 +404,28 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
$sql = 'SELECT *
|
||||
FROM ' . PRIVMSGS_RULES_TABLE . "
|
||||
WHERE user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$user_rules = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$user_rules = phpbb::$db->sql_fetchrowset($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($user_rules))
|
||||
{
|
||||
$sql = 'SELECT zebra_id, friend, foe
|
||||
FROM ' . ZEBRA_TABLE . "
|
||||
WHERE user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$zebra[$row['zebra_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Now build a bare-bone check_row array
|
||||
$result = $db->sql_query($retrieve_sql);
|
||||
$result = phpbb::$db->sql_query($retrieve_sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$check_rows[] = array_merge($row, array(
|
||||
'to' => explode(':', $row['to_address']),
|
||||
@@ -438,22 +438,22 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
|
||||
$user_ids[] = $row['user_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// Retrieve user memberships
|
||||
if (sizeof($user_ids))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USER_GROUP_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_ids) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('user_id', $user_ids) . '
|
||||
AND user_pending = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$memberships[$row['user_id']][] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Now place into the appropriate folder
|
||||
@@ -553,10 +553,10 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
{
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
|
||||
SET pm_unread = 0
|
||||
WHERE ' . $db->sql_in_set('msg_id', $unread_ids) . "
|
||||
WHERE ' . phpbb::$db->sql_in_set('msg_id', $unread_ids) . "
|
||||
AND user_id = $user_id
|
||||
AND folder_id = " . PRIVMSGS_NO_BOX;
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// mark messages as important
|
||||
@@ -566,8 +566,8 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
SET pm_marked = 1 - pm_marked
|
||||
WHERE folder_id = ' . PRIVMSGS_NO_BOX . "
|
||||
AND user_id = $user_id
|
||||
AND " . $db->sql_in_set('msg_id', $important_ids);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', $important_ids);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Move into folder
|
||||
@@ -586,15 +586,15 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
|
||||
$sql = 'SELECT folder_id, pm_count
|
||||
FROM ' . PRIVMSGS_FOLDER_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('folder_id', $sql_folder) . "
|
||||
WHERE ' . phpbb::$db->sql_in_set('folder_id', $sql_folder) . "
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$folder[(int) $row['folder_id']] = (int) $row['pm_count'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
unset($sql_folder);
|
||||
|
||||
@@ -604,9 +604,9 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
FROM ' . PRIVMSGS_TO_TABLE . "
|
||||
WHERE user_id = $user_id
|
||||
AND folder_id = " . PRIVMSGS_INBOX;
|
||||
$result = $db->sql_query($sql);
|
||||
$folder[PRIVMSGS_INBOX] = (int) $db->sql_fetchfield('num_messages');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$folder[PRIVMSGS_INBOX] = (int) phpbb::$db->sql_fetchfield('num_messages');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,14 +641,14 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
WHERE user_id = $user_id
|
||||
AND folder_id = $dest_folder
|
||||
ORDER BY msg_id ASC";
|
||||
$result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - phpbb::$user->data['message_limit']));
|
||||
$result = phpbb::$db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - phpbb::$user->data['message_limit']));
|
||||
|
||||
$delete_ids = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$delete_ids[] = $row['msg_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$num_removed += sizeof($delete_ids);
|
||||
delete_pm($user_id, $delete_ids, $dest_folder);
|
||||
@@ -662,8 +662,8 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
SET folder_id = ' . PRIVMSGS_HOLD_BOX . '
|
||||
WHERE folder_id = ' . PRIVMSGS_NO_BOX . "
|
||||
AND user_id = $user_id
|
||||
AND " . $db->sql_in_set('msg_id', $msg_ary);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', $msg_ary);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -672,16 +672,16 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
WHERE folder_id = " . PRIVMSGS_NO_BOX . "
|
||||
AND user_id = $user_id
|
||||
AND pm_new = 1
|
||||
AND " . $db->sql_in_set('msg_id', $msg_ary);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', $msg_ary);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
if ($dest_folder != PRIVMSGS_INBOX)
|
||||
{
|
||||
$sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . '
|
||||
SET pm_count = pm_count + ' . (int) $db->sql_affectedrows() . "
|
||||
SET pm_count = pm_count + ' . (int) phpbb::$db->sql_affectedrows() . "
|
||||
WHERE folder_id = $dest_folder
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,8 +693,8 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
|
||||
SET folder_id = ' . PRIVMSGS_SENTBOX . '
|
||||
WHERE folder_id = ' . PRIVMSGS_OUTBOX . '
|
||||
AND ' . $db->sql_in_set('msg_id', array_keys($action_ary));
|
||||
$db->sql_query($sql);
|
||||
AND ' . phpbb::$db->sql_in_set('msg_id', array_keys($action_ary));
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Update new/unread count
|
||||
@@ -705,9 +705,9 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false)
|
||||
FROM ' . PRIVMSGS_TO_TABLE . "
|
||||
WHERE user_id = $user_id
|
||||
AND folder_id = " . PRIVMSGS_HOLD_BOX;
|
||||
$result = $db->sql_query($sql);
|
||||
$num_not_moved = (int) $db->sql_fetchfield('num_messages');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$num_not_moved = (int) phpbb::$db->sql_fetchfield('num_messages');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
return array('not_moved' => $num_not_moved, 'removed' => $num_removed);
|
||||
}
|
||||
@@ -734,9 +734,9 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol
|
||||
FROM ' . PRIVMSGS_FOLDER_TABLE . "
|
||||
WHERE folder_id = $dest_folder
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
@@ -756,9 +756,9 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol
|
||||
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||
WHERE folder_id = ' . PRIVMSGS_INBOX . "
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$num_messages = (int) $db->sql_fetchfield('num_messages');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$num_messages = (int) phpbb::$db->sql_fetchfield('num_messages');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit)
|
||||
{
|
||||
@@ -772,9 +772,9 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol
|
||||
SET folder_id = $dest_folder
|
||||
WHERE folder_id = $cur_folder_id
|
||||
AND user_id = $user_id
|
||||
AND " . $db->sql_in_set('msg_id', $move_msg_ids);
|
||||
$db->sql_query($sql);
|
||||
$num_moved = $db->sql_affectedrows();
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', $move_msg_ids);
|
||||
phpbb::$db->sql_query($sql);
|
||||
$num_moved = phpbb::$db->sql_affectedrows();
|
||||
|
||||
// Update pm counts
|
||||
if ($num_moved)
|
||||
@@ -785,7 +785,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol
|
||||
SET pm_count = pm_count - $num_moved
|
||||
WHERE folder_id = $cur_folder_id
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if ($dest_folder != PRIVMSGS_INBOX)
|
||||
@@ -794,7 +794,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol
|
||||
SET pm_count = pm_count + $num_moved
|
||||
WHERE folder_id = $dest_folder
|
||||
AND user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -821,12 +821,12 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id)
|
||||
WHERE msg_id = $msg_id
|
||||
AND user_id = $user_id
|
||||
AND folder_id = $folder_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
SET user_unread_privmsg = user_unread_privmsg - 1
|
||||
WHERE user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
if (phpbb::$user->data['user_id'] == $user_id)
|
||||
{
|
||||
@@ -838,7 +838,7 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id)
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
SET user_unread_privmsg = 0
|
||||
WHERE user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
phpbb::$user->data['user_unread_privmsg'] = 0;
|
||||
}
|
||||
@@ -867,8 +867,8 @@ function handle_mark_actions($user_id, $mark_action)
|
||||
SET pm_marked = 1 - pm_marked
|
||||
WHERE folder_id = $cur_folder_id
|
||||
AND user_id = $user_id
|
||||
AND " . $db->sql_in_set('msg_id', $msg_ids);
|
||||
$db->sql_query($sql);
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', $msg_ids);
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
break;
|
||||
|
||||
@@ -935,21 +935,21 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
// Get PM Information for later deleting
|
||||
$sql = 'SELECT msg_id, pm_unread, pm_new
|
||||
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('msg_id', array_map('intval', $msg_ids)) . "
|
||||
WHERE ' . phpbb::$db->sql_in_set('msg_id', array_map('intval', $msg_ids)) . "
|
||||
AND folder_id = $folder_id
|
||||
AND user_id = $user_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$delete_rows = array();
|
||||
$num_unread = $num_new = $num_deleted = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$num_unread += (int) $row['pm_unread'];
|
||||
$num_new += (int) $row['pm_new'];
|
||||
|
||||
$delete_rows[$row['msg_id']] = 1;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
unset($msg_ids);
|
||||
|
||||
if (!sizeof($delete_rows))
|
||||
@@ -957,7 +957,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
// if no one has read the message yet (meaning it is in users outbox)
|
||||
// then mark the message as deleted...
|
||||
@@ -966,22 +966,22 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
// Remove PM from Outbox
|
||||
$sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . "
|
||||
WHERE user_id = $user_id AND folder_id = " . PRIVMSGS_OUTBOX . '
|
||||
AND ' . $db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$db->sql_query($sql);
|
||||
AND ' . phpbb::$db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
// Update PM Information for safety
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_text = ''
|
||||
WHERE " . $db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$db->sql_query($sql);
|
||||
WHERE " . phpbb::$db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
// Set delete flag for those intended to receive the PM
|
||||
// We do not remove the message actually, to retain some basic information (sent time for example)
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
|
||||
SET pm_deleted = 1
|
||||
WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
$num_deleted = $db->sql_affectedrows();
|
||||
$num_deleted = phpbb::$db->sql_affectedrows();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -989,9 +989,9 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
$sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . "
|
||||
WHERE user_id = $user_id
|
||||
AND folder_id = $folder_id
|
||||
AND " . $db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$db->sql_query($sql);
|
||||
$num_deleted = $db->sql_affectedrows();
|
||||
AND " . phpbb::$db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
phpbb::$db->sql_query($sql);
|
||||
$num_deleted = phpbb::$db->sql_affectedrows();
|
||||
}
|
||||
|
||||
// if folder id is user defined folder then decrease pm_count
|
||||
@@ -1000,7 +1000,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
$sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . "
|
||||
SET pm_count = pm_count - $num_deleted
|
||||
WHERE folder_id = $folder_id";
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Update unread and new status field
|
||||
@@ -1014,7 +1014,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
$set_sql .= 'user_new_privmsg = user_new_privmsg - ' . $num_new;
|
||||
}
|
||||
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id");
|
||||
phpbb::$db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id");
|
||||
|
||||
phpbb::$user->data['user_new_privmsg'] -= $num_new;
|
||||
phpbb::$user->data['user_unread_privmsg'] -= $num_unread;
|
||||
@@ -1023,14 +1023,14 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
// Now we have to check which messages we can delete completely
|
||||
$sql = 'SELECT msg_id
|
||||
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('msg_id', array_keys($delete_rows));
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
unset($delete_rows[$row['msg_id']]);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$delete_ids = array_keys($delete_rows);
|
||||
|
||||
@@ -1045,11 +1045,11 @@ function delete_pm($user_id, $msg_ids, $folder_id)
|
||||
delete_attachments('message', $delete_ids, false);
|
||||
|
||||
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
|
||||
$db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('msg_id', $delete_ids);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1119,11 +1119,11 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
|
||||
{
|
||||
$sql = 'SELECT user_id, username, user_colour
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $u) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('user_id', $u) . '
|
||||
AND user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($check_type == 'to' || $author_id == phpbb::$user->data['user_id'] || $row['user_id'] == phpbb::$user->data['user_id'])
|
||||
{
|
||||
@@ -1137,7 +1137,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (sizeof($g))
|
||||
@@ -1146,28 +1146,28 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
|
||||
{
|
||||
$sql = 'SELECT group_name, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('group_id', $g);
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('group_id', $g);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($check_type == 'to' || $author_id == phpbb::$user->data['user_id'] || $row['user_id'] == phpbb::$user->data['user_id'])
|
||||
{
|
||||
$address[] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id
|
||||
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
|
||||
WHERE ' . $db->sql_in_set('g.group_id', $g) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('g.group_id', $g) . '
|
||||
AND g.group_id = ug.group_id
|
||||
AND ug.user_pending = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($address['group'][$row['group_id']]))
|
||||
{
|
||||
@@ -1183,7 +1183,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false)
|
||||
$address['user'][$row['user_id']]['in_group'] = $row['group_id'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1317,19 +1317,19 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
|
||||
$sql = 'SELECT u.user_type, ug.group_id, ug.user_id
|
||||
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
|
||||
WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
|
||||
AND ug.user_pending = 0
|
||||
AND u.user_id = ug.user_id
|
||||
AND u.user_type IN (' . phpbb::USER_NORMAL . ', ' . phpbb::USER_FOUNDER . ')' .
|
||||
$sql_allow_pm;
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc';
|
||||
$recipients[$row['user_id']] = $field;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!sizeof($recipients))
|
||||
@@ -1338,7 +1338,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
}
|
||||
}
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
phpbb::$db->sql_transaction('begin');
|
||||
|
||||
$sql = '';
|
||||
|
||||
@@ -1402,15 +1402,15 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
|
||||
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward')
|
||||
{
|
||||
$db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data));
|
||||
$data['msg_id'] = $db->sql_nextid();
|
||||
phpbb::$db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_data));
|
||||
$data['msg_id'] = phpbb::$db->sql_nextid();
|
||||
}
|
||||
else if ($mode == 'edit')
|
||||
{
|
||||
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
|
||||
SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . '
|
||||
SET message_edit_count = message_edit_count + 1, ' . phpbb::$db->sql_build_array('UPDATE', $sql_data) . '
|
||||
WHERE msg_id = ' . $data['msg_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1418,7 +1418,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
{
|
||||
if ($sql)
|
||||
{
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
unset($sql);
|
||||
|
||||
@@ -1436,17 +1436,17 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
);
|
||||
}
|
||||
|
||||
$db->sql_multi_insert(PRIVMSGS_TO_TABLE, $sql_ary);
|
||||
phpbb::$db->sql_multi_insert(PRIVMSGS_TO_TABLE, $sql_ary);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1, user_last_privmsg = ' . time() . '
|
||||
WHERE ' . $db->sql_in_set('user_id', array_keys($recipients));
|
||||
$db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($recipients));
|
||||
phpbb::$db->sql_query($sql);
|
||||
|
||||
// Put PM into outbox
|
||||
if ($put_in_outbox)
|
||||
{
|
||||
$db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||
phpbb::$db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array(
|
||||
'msg_id' => (int) $data['msg_id'],
|
||||
'user_id' => (int) $data['from_user_id'],
|
||||
'author_id' => (int) $data['from_user_id'],
|
||||
@@ -1464,7 +1464,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
SET user_lastpost_time = $current_time
|
||||
WHERE user_id = " . $data['from_user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Submit Attachments
|
||||
@@ -1482,18 +1482,18 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
{
|
||||
$sql = 'SELECT attach_id, filesize, physical_filename
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($orphan_rows)) . '
|
||||
AND in_message = 1
|
||||
AND is_orphan = 1
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$orphan_rows = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$orphan_rows[$row['attach_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($data['attachment_data'] as $pos => $attach_row)
|
||||
@@ -1507,10 +1507,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
{
|
||||
// update entry in db if attachment already stored in db and filespace
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . "
|
||||
SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "'
|
||||
SET attach_comment = '" . phpbb::$db->sql_escape($attach_row['attach_comment']) . "'
|
||||
WHERE attach_id = " . (int) $attach_row['attach_id'] . '
|
||||
AND is_orphan = 0';
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1531,11 +1531,11 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
'attach_comment' => $attach_row['attach_comment'],
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . '
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $attach_sql) . '
|
||||
WHERE attach_id = ' . $attach_row['attach_id'] . '
|
||||
AND is_orphan = 1
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1553,10 +1553,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "
|
||||
WHERE draft_id = $draft_id
|
||||
AND user_id = " . $data['from_user_id'];
|
||||
$db->sql_query($sql);
|
||||
phpbb::$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
phpbb::$db->sql_transaction('commit');
|
||||
|
||||
// Send Notifications
|
||||
if ($mode != 'edit')
|
||||
@@ -1584,15 +1584,15 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
|
||||
// Get banned User ID's
|
||||
$sql = 'SELECT ban_userid
|
||||
FROM ' . BANLIST_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . '
|
||||
AND ban_exclude = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
unset($recipients[$row['ban_userid']]);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($recipients))
|
||||
{
|
||||
@@ -1601,11 +1601,11 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
|
||||
|
||||
$sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($recipients)));
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('user_id', array_map('intval', array_keys($recipients)));
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$msg_list_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['user_notify_pm'] == 1 && trim($row['user_email']))
|
||||
{
|
||||
@@ -1618,7 +1618,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message)
|
||||
);
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($msg_list_ary))
|
||||
{
|
||||
@@ -1677,12 +1677,12 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode
|
||||
}
|
||||
$sql .= ' ORDER BY p.message_time DESC';
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1706,8 +1706,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode
|
||||
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
|
||||
}
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
$db->sql_freeresult($result);
|
||||
while ($row = phpbb::$db->sql_fetchrow($result));
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$title = $row['message_subject'];
|
||||
|
||||
@@ -1817,9 +1817,9 @@ function set_user_message_limit()
|
||||
WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . '
|
||||
AND ug.user_pending = 0
|
||||
AND ug.group_id = g.group_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$message_limit = (int) $db->sql_fetchfield('max_message_limit');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$message_limit = (int) phpbb::$db->sql_fetchfield('max_message_limit');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
phpbb::$user->data['message_limit'] = (!$message_limit) ? phpbb::$config['pm_max_msgs'] : $message_limit;
|
||||
}
|
||||
|
@@ -61,9 +61,9 @@ class custom_profile
|
||||
AND l.lang_id = $lang_id
|
||||
AND l.field_id = f.field_id
|
||||
ORDER BY f.field_order";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
// Return templated field
|
||||
$tpl_snippet = $this->process_field_row('change', $row);
|
||||
@@ -79,7 +79,7 @@ class custom_profile
|
||||
'S_REQUIRED' => ($row['field_required']) ? true : false)
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,13 +211,13 @@ class custom_profile
|
||||
AND f.field_no_view = 0
|
||||
AND l.field_id = f.field_id
|
||||
ORDER BY f.field_order';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$this->profile_cache[$row['field_ident']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,14 +243,14 @@ class custom_profile
|
||||
AND lang_id = $lang_id
|
||||
AND field_type = $field_type
|
||||
ORDER BY option_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
// @todo: ref optimize
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$this->options_lang[$field_id][$lang_id][($row['option_id'] + 1)] = $row['lang_value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,9 +288,9 @@ class custom_profile
|
||||
$sql_where
|
||||
AND l.field_id = f.field_id
|
||||
ORDER BY f.field_order";
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$cp_data['pf_' . $row['field_ident']] = $this->get_profile_field($row);
|
||||
$check_value = $cp_data['pf_' . $row['field_ident']];
|
||||
@@ -340,7 +340,7 @@ class custom_profile
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,15 +369,15 @@ class custom_profile
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . PROFILE_FIELDS_DATA_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', array_map('intval', $user_id));
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('user_id', array_map('intval', $user_id));
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$field_data = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$field_data[$row['user_id']] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$user_fields = array();
|
||||
|
||||
@@ -783,11 +783,11 @@ class custom_profile
|
||||
$sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value
|
||||
FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
|
||||
WHERE l.lang_id = ' . phpbb::$user->get_iso_lang_id() . '
|
||||
' . ((sizeof($sql_not_in)) ? ' AND ' . $db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
|
||||
' . ((sizeof($sql_not_in)) ? ' AND ' . phpbb::$db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
|
||||
AND l.field_id = f.field_id';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['field_default_value'] == 'now' && $row['field_type'] == FIELD_DATE)
|
||||
{
|
||||
@@ -797,7 +797,7 @@ class custom_profile
|
||||
|
||||
$cp_data['pf_' . $row['field_ident']] = (in_array($row['field_type'], array(FIELD_TEXT, FIELD_STRING))) ? $row['lang_default_value'] : $row['field_default_value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
return $cp_data;
|
||||
}
|
||||
|
@@ -137,13 +137,13 @@ class bbcode_firstpass extends bbcode
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . BBCODES_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$rowset[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
foreach ($rowset as $row)
|
||||
@@ -1250,10 +1250,10 @@ class parse_message extends bbcode_firstpass
|
||||
// For now setting the ttl to 10 minutes
|
||||
$sql = 'SELECT *
|
||||
FROM ' . SMILIES_TABLE . '
|
||||
ORDER BY ' . $db->sql_function('length_varchar', 'code') . ' DESC';
|
||||
$result = $db->sql_query($sql, 600);
|
||||
ORDER BY ' . phpbb::$db->sql_function('length_varchar', 'code') . ' DESC';
|
||||
$result = phpbb::$db->sql_query($sql, 600);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (empty($row['code']))
|
||||
{
|
||||
@@ -1264,7 +1264,7 @@ class parse_message extends bbcode_firstpass
|
||||
$match[] = '(?<=^|[\n .])' . preg_quote($row['code'], '#') . '(?![^<>]*>)';
|
||||
$replace[] = '<!-- s' . $row['code'] . ' --><img src="{SMILIES_PATH}/' . $row['smiley_url'] . '" alt="' . $row['code'] . '" title="' . $row['emotion'] . '" /><!-- s' . $row['code'] . ' -->';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (sizeof($match))
|
||||
@@ -1343,10 +1343,10 @@ class parse_message extends bbcode_firstpass
|
||||
'poster_id' => phpbb::$user->data['user_id'],
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
phpbb::$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
|
||||
|
||||
$new_entry = array(
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'attach_id' => phpbb::$db->sql_nextid(),
|
||||
'is_orphan' => 1,
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'attach_comment'=> $this->filename_data['filecomment'],
|
||||
@@ -1394,9 +1394,9 @@ class parse_message extends bbcode_firstpass
|
||||
WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id'] . '
|
||||
AND is_orphan = 1
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$row = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
@@ -1407,7 +1407,7 @@ class parse_message extends bbcode_firstpass
|
||||
phpbb_unlink($row['physical_filename'], 'thumbnail');
|
||||
}
|
||||
|
||||
$db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']);
|
||||
phpbb::$db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1445,10 +1445,10 @@ class parse_message extends bbcode_firstpass
|
||||
'poster_id' => phpbb::$user->data['user_id'],
|
||||
);
|
||||
|
||||
$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
phpbb::$db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary));
|
||||
|
||||
$new_entry = array(
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'attach_id' => phpbb::$db->sql_nextid(),
|
||||
'is_orphan' => 1,
|
||||
'real_filename' => $filedata['real_filename'],
|
||||
'attach_comment'=> $this->filename_data['filecomment'],
|
||||
@@ -1508,11 +1508,11 @@ class parse_message extends bbcode_firstpass
|
||||
// Get the attachment data, based on the poster id...
|
||||
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($not_orphan)) . '
|
||||
AND poster_id = ' . $check_user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$pos = $not_orphan[(int) $row['attach_id']];
|
||||
$this->attachment_data[$pos] = $row;
|
||||
@@ -1520,7 +1520,7 @@ class parse_message extends bbcode_firstpass
|
||||
|
||||
unset($not_orphan[(int) $row['attach_id']]);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (sizeof($not_orphan))
|
||||
@@ -1533,12 +1533,12 @@ class parse_message extends bbcode_firstpass
|
||||
{
|
||||
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . '
|
||||
WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($orphan)) . '
|
||||
AND poster_id = ' . phpbb::$user->data['user_id'] . '
|
||||
AND is_orphan = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$pos = $orphan[(int) $row['attach_id']];
|
||||
$this->attachment_data[$pos] = $row;
|
||||
@@ -1546,7 +1546,7 @@ class parse_message extends bbcode_firstpass
|
||||
|
||||
unset($orphan[(int) $row['attach_id']]);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (sizeof($orphan))
|
||||
|
@@ -46,9 +46,9 @@ class fulltext_mysql extends search_backend
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
|
||||
$info = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
|
||||
$info = phpbb::$db->sql_fetchrow($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$engine = '';
|
||||
if (isset($info['Engine']))
|
||||
@@ -67,14 +67,14 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
$sql = 'SHOW VARIABLES
|
||||
LIKE \'ft\_%\'';
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
$mysql_info = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$mysql_info[$row['Variable_name']] = $row['Value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
set_config('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
|
||||
set_config('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);
|
||||
@@ -336,7 +336,7 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . phpbb::$db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
|
||||
}
|
||||
|
||||
$sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : '';
|
||||
@@ -348,7 +348,7 @@ class fulltext_mysql extends search_backend
|
||||
$sql_where_options = $sql_sort_join;
|
||||
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
|
||||
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
|
||||
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . phpbb::$db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||
$sql_where_options .= $m_approve_fid_sql;
|
||||
$sql_where_options .= (sizeof($author_ary)) ? ' AND p.poster_id ' . $sql_author : '';
|
||||
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
@@ -356,16 +356,16 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
$sql = "SELECT $sql_select
|
||||
FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p
|
||||
WHERE MATCH ($sql_match) AGAINST ('" . $db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE)
|
||||
WHERE MATCH ($sql_match) AGAINST ('" . phpbb::$db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE)
|
||||
$sql_where_options
|
||||
ORDER BY $sql_sort";
|
||||
$result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start);
|
||||
$result = phpbb::$db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$id_ary[] = $row[$field];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$id_ary = array_unique($id_ary);
|
||||
|
||||
@@ -378,9 +378,9 @@ class fulltext_mysql extends search_backend
|
||||
if (!$result_count)
|
||||
{
|
||||
$sql = 'SELECT FOUND_ROWS() as result_count';
|
||||
$result = $db->sql_query($sql);
|
||||
$result_count = (int) $db->sql_fetchfield('result_count');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$result_count = (int) phpbb::$db->sql_fetchfield('result_count');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!$result_count)
|
||||
{
|
||||
@@ -436,8 +436,8 @@ class fulltext_mysql extends search_backend
|
||||
$id_ary = array();
|
||||
|
||||
// Create some display specific sql strings
|
||||
$sql_author = $db->sql_in_set('p.poster_id', $author_ary);
|
||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||
$sql_author = phpbb::$db->sql_in_set('p.poster_id', $author_ary);
|
||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . phpbb::$db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
||||
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
|
||||
@@ -473,7 +473,7 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . phpbb::$db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
|
||||
}
|
||||
|
||||
// If the cache was completely empty count the results
|
||||
@@ -512,21 +512,21 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
|
||||
// Only read one block of posts from the db and then cache it
|
||||
$result = $db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start);
|
||||
$result = phpbb::$db->sql_query_limit($sql, phpbb::$config['search_block_size'], $start);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
$id_ary[] = $row[$field];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
// retrieve the total result count if needed
|
||||
if (!$result_count)
|
||||
{
|
||||
$sql = 'SELECT FOUND_ROWS() as result_count';
|
||||
$result = $db->sql_query($sql);
|
||||
$result_count = (int) $db->sql_fetchfield('result_count');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$result_count = (int) phpbb::$db->sql_fetchfield('result_count');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
if (!$result_count)
|
||||
{
|
||||
@@ -622,10 +622,10 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
if (sizeof($alter))
|
||||
{
|
||||
$db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
|
||||
phpbb::$db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
|
||||
}
|
||||
|
||||
$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
|
||||
phpbb::$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -665,10 +665,10 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
if (sizeof($alter))
|
||||
{
|
||||
$db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
|
||||
phpbb::$db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
|
||||
}
|
||||
|
||||
$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
|
||||
phpbb::$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
private function get_stats()
|
||||
{
|
||||
if ($db->dbms_type !== 'mysql')
|
||||
if (phpbb::$db->dbms_type !== 'mysql')
|
||||
{
|
||||
$this->stats = array();
|
||||
return;
|
||||
@@ -711,9 +711,9 @@ class fulltext_mysql extends search_backend
|
||||
|
||||
$sql = 'SHOW INDEX
|
||||
FROM ' . POSTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
// deal with older MySQL versions which didn't use Index_type
|
||||
$index_type = (isset($row['Index_type'])) ? $row['Index_type'] : $row['Comment'];
|
||||
@@ -734,13 +734,13 @@ class fulltext_mysql extends search_backend
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT COUNT(post_id) as total_posts
|
||||
FROM ' . POSTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$this->stats['total_posts'] = (int) $db->sql_fetchfield('total_posts');
|
||||
$db->sql_freeresult($result);
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
$this->stats['total_posts'] = (int) phpbb::$db->sql_fetchfield('total_posts');
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user