mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
- change it a bit. ;)
git-svn-id: file:///svn/phpbb/trunk@5470 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
247a7a8182
commit
086d4dceac
1 changed files with 72 additions and 62 deletions
|
@ -646,29 +646,15 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
|||
{
|
||||
global $user, $db, $template, $phpEx, $SID, $auth;
|
||||
|
||||
// Only those fitting into this forum...
|
||||
if ($forum_id || $topic_id)
|
||||
{
|
||||
$sql = 'SELECT d.draft_id, d.topic_id, d.forum_id, d.draft_subject, d.save_time, f.forum_name
|
||||
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
|
||||
WHERE d.user_id = ' . $user->data['user_id'] . '
|
||||
AND f.forum_id = d.forum_id ' .
|
||||
(($forum_id) ? " AND f.forum_id = $forum_id" : '') . '
|
||||
ORDER BY d.save_time DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load those drafts not connected to forums/topics
|
||||
$sql = 'SELECT *
|
||||
FROM ' . DRAFTS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
AND forum_id = 0
|
||||
AND topic_id = 0
|
||||
OR topic_id = 0
|
||||
ORDER BY save_time DESC';
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$draftrows = $topic_ids = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_id'])
|
||||
|
@ -679,6 +665,33 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Only those fitting into this forum now...
|
||||
if ($forum_id || $topic_id)
|
||||
{
|
||||
$sql = 'SELECT d.draft_id, d.topic_id, d.forum_id, d.draft_subject, d.save_time, f.forum_name
|
||||
FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
|
||||
WHERE d.user_id = ' . $user->data['user_id'] . '
|
||||
AND d.forum_id = f.forum_id ' .
|
||||
(($forum_id) ? " AND d.forum_id = $forum_id" : '') . '
|
||||
ORDER BY d.save_time DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_id'])
|
||||
{
|
||||
$topic_ids[] = (int) $row['topic_id'];
|
||||
}
|
||||
$draftrows[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
if (!sizeof($draftrows))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (sizeof($topic_ids))
|
||||
{
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title
|
||||
|
@ -694,8 +707,6 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
|||
}
|
||||
unset($topic_ids);
|
||||
|
||||
if (sizeof($draftrows))
|
||||
{
|
||||
$template->assign_var('S_SHOW_DRAFTS', true);
|
||||
|
||||
foreach ($draftrows as $draft)
|
||||
|
@ -740,7 +751,6 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Topic Review
|
||||
|
|
Loading…
Add table
Reference in a new issue