mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-26 05:08:52 +00:00
Move to sql_query_limit
git-svn-id: file:///svn/phpbb/trunk@3686 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f9f6cb194d
commit
ab34d6329c
2 changed files with 33 additions and 29 deletions
|
@ -26,7 +26,7 @@ function generate_smilies($mode)
|
||||||
global $SID, $auth, $db, $user, $config, $template;
|
global $SID, $auth, $db, $user, $config, $template;
|
||||||
global $starttime, $phpEx, $phpbb_root_path;
|
global $starttime, $phpEx, $phpbb_root_path;
|
||||||
|
|
||||||
// TODO: To be added to the schema
|
// TODO: To be added to the schema - discuss this first please :)
|
||||||
$config['max_smilies_inline'] = 20;
|
$config['max_smilies_inline'] = 20;
|
||||||
|
|
||||||
if ($mode == 'window')
|
if ($mode == 'window')
|
||||||
|
@ -95,19 +95,15 @@ function generate_topic_icons($mode, $enable_icons)
|
||||||
|
|
||||||
if (!$enable_icons)
|
if (!$enable_icons)
|
||||||
{
|
{
|
||||||
return (false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = false;
|
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = array();
|
||||||
obtain_icons($icons);
|
obtain_icons($icons);
|
||||||
|
|
||||||
if (sizeof($icons))
|
if (sizeof($icons))
|
||||||
{
|
{
|
||||||
$result = true;
|
|
||||||
|
|
||||||
foreach ($icons as $id => $data)
|
foreach ($icons as $id => $data)
|
||||||
{
|
{
|
||||||
if ($data['display'])
|
if ($data['display'])
|
||||||
|
@ -122,9 +118,11 @@ function generate_topic_icons($mode, $enable_icons)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($result);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DECODE TEXT -> This will/should be handled by bbcode.php eventually
|
// DECODE TEXT -> This will/should be handled by bbcode.php eventually
|
||||||
|
@ -224,9 +222,8 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
||||||
WHERE p.topic_id = $topic_id
|
WHERE p.topic_id = $topic_id
|
||||||
AND p.poster_id = u.user_id
|
AND p.poster_id = u.user_id
|
||||||
ORDER BY p.post_time DESC
|
ORDER BY p.post_time DESC";
|
||||||
LIMIT " . $config['posts_per_page'];
|
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
// Okay, let's do the loop, yeah come on baby let's do the loop
|
// Okay, let's do the loop, yeah come on baby let's do the loop
|
||||||
// and it goes like this ...
|
// and it goes like this ...
|
||||||
|
@ -324,11 +321,16 @@ function update_last_post_information($type, $id)
|
||||||
|
|
||||||
$sql = "SELECT p.post_id, p.poster_id, p.post_time, u.username, p.post_username " . $sql_select_add . "
|
$sql = "SELECT p.post_id, p.poster_id, p.post_time, u.username, p.post_username " . $sql_select_add . "
|
||||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t " . $sql_table_add . "
|
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . TOPICS_TABLE . " t " . $sql_table_add . "
|
||||||
WHERE (p.post_approved = 1) AND (t.topic_approved = 1) AND (p.poster_id = u.user_id) AND (t.topic_id = p.topic_id) " . $sql_where_add . "
|
WHERE p.post_approved = 1
|
||||||
ORDER BY p.post_time DESC LIMIT 1";
|
AND t.topic_approved = 1
|
||||||
|
AND p.poster_id = u.user_id
|
||||||
|
AND t.topic_id = p.topic_id
|
||||||
|
$sql_where_add
|
||||||
|
ORDER BY p.post_time DESC";
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($type == 'forum')
|
if ($type == 'forum')
|
||||||
{
|
{
|
||||||
|
@ -663,7 +665,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
|
||||||
|
|
||||||
$post_data['subject'] = $subject;
|
$post_data['subject'] = $subject;
|
||||||
|
|
||||||
$db->sql_transaction('begin');
|
$db->sql_transaction();
|
||||||
|
|
||||||
// Initial Topic table info
|
// Initial Topic table info
|
||||||
if ( ($mode == 'post') || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id']))
|
if ( ($mode == 'post') || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id']))
|
||||||
|
@ -868,7 +870,7 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $post_data)
|
||||||
|
|
||||||
$search = new fulltext_search();
|
$search = new fulltext_search();
|
||||||
|
|
||||||
$db->sql_transaction('begin');
|
$db->sql_transaction();
|
||||||
|
|
||||||
$sql = "DELETE FROM " . POSTS_TABLE . "
|
$sql = "DELETE FROM " . POSTS_TABLE . "
|
||||||
WHERE post_id = " . $post_id;
|
WHERE post_id = " . $post_id;
|
||||||
|
@ -917,12 +919,16 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $post_data)
|
||||||
// TODO: delete common words... maybe just call search_tidy ?
|
// TODO: delete common words... maybe just call search_tidy ?
|
||||||
// $search->del_words($post_id);
|
// $search->del_words($post_id);
|
||||||
|
|
||||||
$sql = "SELECT p.post_id, p.poster_id, p.post_username, u.username FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
$sql = "SELECT p.post_id, p.poster_id, p.post_username, u.username
|
||||||
WHERE p.topic_id = " . $topic_id . " AND p.poster_id = u.user_id AND p.post_approved = 1
|
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
||||||
ORDER BY p.post_time DESC LIMIT 1";
|
WHERE p.topic_id = " . $topic_id . "
|
||||||
|
AND p.poster_id = u.user_id
|
||||||
|
AND p.post_approved = 1
|
||||||
|
ORDER BY p.post_time DESC";
|
||||||
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// If Post is first post, but not the only post... make next post the topic starter one. ;)
|
// If Post is first post, but not the only post... make next post the topic starter one. ;)
|
||||||
if (($post_data['topic_first_post_id'] != $post_data['topic_last_post_id']) && ($post_id == $post_data['topic_first_post_id']))
|
if (($post_data['topic_first_post_id'] != $post_data['topic_last_post_id']) && ($post_id == $post_data['topic_first_post_id']))
|
||||||
|
|
|
@ -270,9 +270,8 @@ if ($forum_data['forum_postable'])
|
||||||
WHERE (t.forum_id = $forum_id
|
WHERE (t.forum_id = $forum_id
|
||||||
OR t.forum_id = 0)
|
OR t.forum_id = 0)
|
||||||
AND t.topic_type = " . POST_ANNOUNCE . "
|
AND t.topic_type = " . POST_ANNOUNCE . "
|
||||||
ORDER BY $sort_order_sql
|
ORDER BY $sort_order_sql";
|
||||||
LIMIT " . $config['topics_per_page'];
|
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -290,8 +289,7 @@ if ($forum_data['forum_postable'])
|
||||||
" . (($auth->acl_gets('m_approve', 'a_', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
" . (($auth->acl_gets('m_approve', 'a_', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
||||||
AND t.topic_type <> " . POST_ANNOUNCE . "
|
AND t.topic_type <> " . POST_ANNOUNCE . "
|
||||||
$limit_topics_time
|
$limit_topics_time
|
||||||
ORDER BY t.topic_type DESC, $sort_order_sql
|
ORDER BY t.topic_type DESC, $sort_order_sql";
|
||||||
LIMIT $start, " . $config['topics_per_page'];
|
|
||||||
/* }
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -310,7 +308,7 @@ if ($forum_data['forum_postable'])
|
||||||
AND u2.user_id = t.topic_last_poster_id
|
AND u2.user_id = t.topic_last_poster_id
|
||||||
ORDER BY $sort_order";
|
ORDER BY $sort_order";
|
||||||
}*/
|
}*/
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue