Index: install/sql/mysql.sql
===================================================================
--- install/sql/mysql.sql (revision 558)
+++ install/sql/mysql.sql (working copy)
@@ -1297,6 +1297,7 @@
`topic_dl_type` tinyint(1) NOT NULL DEFAULT '0',
`topic_last_post_time` int(11) NOT NULL DEFAULT '0',
`topic_show_first_post` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `is_draft` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`topic_id`),
KEY `forum_id` (`forum_id`),
KEY `topic_last_post_id` (`topic_last_post_id`),
@@ -1308,7 +1309,7 @@
-- Дамп данных таблицы `bb_topics`
--
-INSERT INTO `bb_topics` VALUES (1, 1, 'Добро пожаловать в TorrentPier II', 2, 1309421220, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 972086460, 0);
+INSERT INTO `bb_topics` VALUES (1, 1, 'Добро пожаловать в TorrentPier II', 2, 1309421220, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 972086460, 0, 0);
-- --------------------------------------------------------
Index: upload/ajax.php
===================================================================
--- upload/ajax.php (revision 558)
+++ upload/ajax.php (working copy)
@@ -45,6 +45,7 @@
break;
case 'manage_user':
+ case 'modify_draft':
require(INC_DIR .'functions_admin.php');
break;
@@ -82,6 +83,7 @@
'gen_passkey' => array('user'),
'change_torrent' => array('user'),
'change_tor_status' => array('user'),
+ 'modify_draft' => array('user'),
'view_profile' => array('user'),
'view_post' => array('guest'),
@@ -533,6 +535,45 @@
require(AJAX_DIR .'index_data.php');
}
+ function modify_draft()
+ {
+ global $userdata, $bb_cfg, $lang;
+
+ if(!$bb_cfg['status_of_draft']) $this->ajax_die($lang['MODULE_OFF']);
+
+ $tid = (int)$this->request['id_draft'];
+ $mode = (int)$this->request['mode'];
+ $sql = "SELECT * FROM ". BB_TOPICS ." WHERE topic_id = {$tid}";
+
+ if (!$row = DB()->fetch_row($sql)) $this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
+
+ if ($row['topic_poster'] != $userdata['user_id'] && !IS_ADMIN) $this->ajax_die($lang['CANNOT_DELETE_DRAFT']);
+
+ if (!$mode)
+ {
+ topic_delete($tid);
+ }
+ else
+ {
+ require_once(INC_DIR . 'functions_post.php');
+ DB()->query("
+ UPDATE
+ ". BB_POSTS ." p,
+ ". BB_TOPICS ." t
+ SET
+ p.post_time = ". TIMENOW .",
+ t.is_draft = 0,
+ t.topic_last_post_time = ". TIMENOW .",
+ t.topic_time = ". TIMENOW ."
+ WHERE
+ t.topic_id = {$tid}
+ AND t.topic_first_post_id = p.post_id
+ ");
+ update_draft('no_draft', $row['forum_id'], $tid, $row['topic_dl_type'], $row['topic_first_post_id'], $row['topic_poster']);
+ }
+ $this->response['tid'] = $tid;
+ }
+
function view_profile()
{
require(AJAX_DIR .'view_profile.php');
Index: upload/config.php
===================================================================
--- upload/config.php (revision 558)
+++ upload/config.php (working copy)
@@ -55,8 +55,8 @@
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)';
-$bb_cfg['tp_release_date'] = '16-01-2014';
-$bb_cfg['tp_release_state'] = 'R558';
+$bb_cfg['tp_release_date'] = '15-01-2014';
+$bb_cfg['tp_release_state'] = 'R557';
// Database
$charset = 'utf8';
@@ -537,4 +537,7 @@
);
// SEO
-$bb_cfg['seo_link_home_page'] = false;
\ No newline at end of file
+$bb_cfg['seo_link_home_page'] = false;
+
+// Status of draft
+$bb_cfg['status_of_draft'] = false;
\ No newline at end of file
Index: upload/includes/datastore/build_cat_forums.php
===================================================================
--- upload/includes/datastore/build_cat_forums.php (revision 558)
+++ upload/includes/datastore/build_cat_forums.php (working copy)
@@ -137,6 +137,7 @@
FROM ". BB_TOPICS ."
WHERE forum_id IN ($news_forum_ids)
AND topic_moved_id = 0
+ AND is_draft = 0
ORDER BY topic_time DESC
LIMIT $news_count
");
@@ -156,6 +157,7 @@
FROM ". BB_TOPICS ."
WHERE forum_id IN ($net_forum_ids)
AND topic_moved_id = 0
+ AND is_draft = 0
ORDER BY topic_time DESC
LIMIT $net_count
");
Index: upload/includes/functions_post.php
===================================================================
--- upload/includes/functions_post.php (revision 558)
+++ upload/includes/functions_post.php (working copy)
@@ -105,7 +105,7 @@
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, $update_post_time)
{
- global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore;
+ global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore, $to_draft;
$current_time = TIMENOW;
@@ -159,7 +159,7 @@
$topic_dl_type = (isset($_POST['topic_dl_type']) && ($post_info['allow_reg_tracker'] || $is_auth['auth_mod'])) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;
- if (($mode == 'editpost' && $post_data['first_post']))
+ if (($mode == 'editpost' && $post_data['first_post']) && !$to_draft && $to_draft != $post_data['is_draft'])
{
$sql_update = "
UPDATE
@@ -171,6 +171,7 @@
t.topic_type = $topic_type,
t.topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
t.topic_vote = " . $topic_vote : "") . ",
+ t.is_draft = $to_draft,
t.topic_last_post_time = ". TIMENOW .",
t.topic_time = ". TIMENOW ."
WHERE
@@ -187,13 +188,14 @@
topic_title = '$post_subject',
topic_type = $topic_type,
topic_dl_type = $topic_dl_type " . ((@$post_data['edit_vote'] || !empty($poll_title)) ? ",
- topic_vote = " . $topic_vote : "") . "
+ topic_vote = " . $topic_vote : "") . ",
+ is_draft = $to_draft
WHERE
topic_id = $topic_id
";
}
- $sql = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote)" : $sql_update;
+ $sql = ($mode != "editpost") ? "INSERT INTO " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type, topic_vote, is_draft) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type, $topic_vote, $to_draft)" : $sql_update;
if (!DB()->sql_query($sql))
{
@@ -346,6 +348,7 @@
//
function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id)
{
+ $to_draft = (isset($post_data['to_draft'])) ? $post_data['to_draft'] : 0;
$sign = ($mode == 'delete') ? '- 1' : '+ 1';
$forum_update_sql = "forum_posts = forum_posts $sign";
$topic_update_sql = '';
@@ -414,7 +417,10 @@
}
else if ($mode != 'poll_delete')
{
- $forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : "");
+ if (!$to_draft)
+ {
+ $forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : "");
+ }
$topic_update_sql = "topic_last_post_id = $post_id, topic_last_post_time = ". TIMENOW . (($mode == 'reply') ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id");
}
else
@@ -422,10 +428,15 @@
$topic_update_sql .= 'topic_vote = 0';
}
- $sql = "UPDATE " . BB_FORUMS . " SET $forum_update_sql WHERE forum_id = $forum_id";
- if (!DB()->sql_query($sql))
+ if (!$to_draft)
{
- message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
+ $sql = "UPDATE " . BB_FORUMS . " SET
+ $forum_update_sql
+ WHERE forum_id = $forum_id";
+ if (!DB()->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
+ }
}
if ($topic_update_sql != '')
@@ -439,7 +450,7 @@
}
}
- if ($mode != 'poll_delete')
+ if ($mode != 'poll_delete' || $to_draft)
{
$sql = "UPDATE " . BB_USERS . "
SET user_posts = user_posts $sign
@@ -452,6 +463,67 @@
}
//
+// Update draft status
+//
+function update_draft($mode, $forum_id, $topic_id, $topic_dl_type, $post_id, $user_id)
+{
+ global $datastore;
+ $sign = ($mode == 'is_draft') ? '- 1' : '+ 1';
+ $forum_update_sql = "u.user_posts = u.user_posts $sign, f.forum_posts = f.forum_posts $sign, f.forum_topics = f.forum_topics $sign";
+
+ if ($mode == 'is_draft')
+ {
+ $sql = "SELECT topic_last_post_id
+ FROM " . BB_TOPICS . "
+ WHERE forum_id = $forum_id
+ AND is_draft = 0
+ ORDER BY topic_last_post_time DESC
+ LIMIT 1";
+ if (!($result = DB()->sql_query($sql)))
+ {
+ message_die(GENERAL_ERROR, 'Error in finding the post id', '', __LINE__, __FILE__, $sql);
+ }
+
+ if ($row = DB()->sql_fetchrow($result))
+ {
+ $forum_update_sql .= ', f.forum_last_post_id = ' . $row['topic_last_post_id'];
+
+ if ($topic_dl_type == TOPIC_DL_TYPE_DL)
+ {
+ $sql = "SELECT attach_id
+ FROM ". BB_ATTACHMENTS ."
+ WHERE post_id = $post_id";
+ if (!($result = DB()->sql_query($sql)))
+ {
+ message_die(GENERAL_ERROR, 'Error in finding the attachment id', '', __LINE__, __FILE__, $sql);
+ }
+
+ if ($row = DB()->sql_fetchrow($result))
+ {
+ require_once(INC_DIR .'functions_torrent.php');
+ tracker_unregister($row['attach_id']);
+ }
+ }
+ }
+ }
+ else
+ {
+ $forum_update_sql .= ', f.forum_last_post_id = ' . $post_id;
+ }
+
+ $sql = "UPDATE ". BB_FORUMS ." f, ". BB_USERS ." u SET
+ $forum_update_sql
+ WHERE f.forum_id = $forum_id
+ AND u.user_id = $user_id";
+ if (!DB()->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
+ }
+ cache_rm_user_sessions($user_id);
+ $datastore->update('cat_forums');
+}
+
+//
// Delete a post/poll
//
function delete_post($mode, $post_data, &$message, &$meta, $forum_id, $topic_id, $post_id, $poll_id)
Index: upload/includes/page_header.php
===================================================================
--- upload/includes/page_header.php (revision 558)
+++ upload/includes/page_header.php (working copy)
@@ -275,6 +275,7 @@
'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&o=5",
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
+ 'U_MY_DRAFTS' => "profile.php?mode=viewdraft&u={$userdata['user_id']}",
));
if (!empty($page_cfg['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp']))
Index: upload/includes/ucp/usercp_viewdraft.php
===================================================================
--- upload/includes/ucp/usercp_viewdraft.php (revision 0)
+++ upload/includes/ucp/usercp_viewdraft.php (working copy)
@@ -0,0 +1,55 @@
+fetch_rowset($sql))
+{
+ bb_die($lang['NO_DRAFTS'] . '
'. $lang['RETURN_PROFILE'] .'
'. sprintf($lang['CLICK_RETURN_INDEX'], '', ''));
+}
+
+$i = 0;
+foreach ($rows as $row)
+{
+ $category = ''. $row['cat_title'] .'';
+ $forum = ''. $row['forum_name'] .'';
+ $topic = ''. $row['topic_title'] .'';
+
+ if($row["parent_id"] != 0) $forum .= ' » '. $row['parent_name'] .'';
+
+ $template->assign_block_vars('DRAFT', array(
+ "ROW_CLASS" => ($i % 2) ? 2 : 1,
+ "TOPIC_ID" => $row['topic_id'],
+ "TOPIC" => $topic,
+ 'FORUM' => $forum,
+ "CATEGORY" => $category,
+ "DT_CREATE" => bb_date($row['topic_time'], 'Y-m-d H:i'),
+ "EDIT_POST" => make_url('posting.php?mode=editpost&p='. $row['topic_first_post_id'])
+ ));
+ $i++;
+}
+
+$template->assign_vars(array(
+ "PAGE_TITLE" => $lang['DRAFTS'],
+ "USERNAME" => $profiledata['username'],
+ "PROFILE" => profile_url(array('username' => $profiledata['username'], 'user_id' => $profiledata['user_id'])),
+));
+
+print_page('usercp_viewdraft.tpl');
\ No newline at end of file
Index: upload/includes/ucp/usercp_viewprofile.php
===================================================================
--- upload/includes/ucp/usercp_viewprofile.php (revision 558)
+++ upload/includes/ucp/usercp_viewprofile.php (working copy)
@@ -96,6 +96,17 @@
$signature = bbcode2html($signature);
}
+if($bb_cfg['status_of_draft'])
+{
+ $count_draft = DB()->fetch_row("
+ SELECT COUNT(topic_id) as count
+ FROM ". BB_TOPICS . "
+ WHERE topic_poster = {$profiledata['user_id']}
+ AND is_draft = 1
+ ");
+ $count_draft = $count_draft["count"];
+}
+
$template->assign_vars(array(
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'USERNAME' => $profiledata['username'],
@@ -116,6 +127,8 @@
'LOCATION' => $profiledata['user_from'],
'USER_ACTIVE' => $profiledata['user_active'],
+ 'COUNT_DRAFT' => ($bb_cfg['status_of_draft']) ? $count_draft : '',
+ 'SHOW_DRAFT' => ($bb_cfg['status_of_draft'] && (IS_ADMIN || $profile_user_id)),
'OCCUPATION' => $profiledata['user_occ'],
'INTERESTS' => $profiledata['user_interests'],
'SKYPE' => $profiledata['user_skype'],
@@ -130,6 +143,7 @@
'U_SEARCH_USER' => "search.php?search_author=1&uid={$profiledata['user_id']}",
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&myt=1",
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
+ 'U_DRAFTS' => "profile.php?mode=viewdraft&u={$profiledata['user_id']}",
'S_PROFILE_ACTION' => 'profile.php',
Index: upload/language/lang_english/lang_main.php
===================================================================
--- upload/language/lang_english/lang_main.php (revision 558)
+++ upload/language/lang_english/lang_main.php (working copy)
@@ -225,6 +225,7 @@
$lang['TOPIC_STICKY'] = 'Sticky:';
$lang['TOPIC_MOVED'] = 'Moved:';
$lang['TOPIC_POLL'] = '[ Poll ]';
+$lang['TOPIC_DRAFT'] = '[ Draft ]';
$lang['MARK_TOPICS_READ'] = 'Mark all topics read';
$lang['TOPICS_MARKED_READ'] = 'The topics for this forum have just been marked read';
@@ -382,6 +383,11 @@
$lang['ATTACH_SIGNATURE'] = 'Attach signature (signatures can be changed in profile)';
$lang['NOTIFY'] = 'Notify me when a reply is posted';
+$lang['TO_DRAFT'] = 'Save as Draft';
+$lang['DRAFTS'] = 'Drafts';
+$lang['CANNOT_DELETE_DRAFT'] = 'Sorry, but you may not delete other user\'s drafts';
+$lang['CANNOT_VIEW_DRAFT'] = 'Sorry, but you may not view other user\'s drafts';
+$lang['NO_DRAFTS'] = 'The draft list is empty';
$lang['STORED'] = 'Your message has been entered successfully.';
$lang['DELETED'] = 'Your message has been deleted successfully.';
Index: upload/language/lang_russian/lang_main.php
===================================================================
--- upload/language/lang_russian/lang_main.php (revision 558)
+++ upload/language/lang_russian/lang_main.php (working copy)
@@ -223,6 +223,7 @@
$lang['TOPIC_STICKY'] = 'Прилеплена:';
$lang['TOPIC_MOVED'] = 'Перемещена:';
$lang['TOPIC_POLL'] = '[ Опрос ]';
+$lang['TOPIC_DRAFT'] = '[ Черновик ]';
$lang['MARK_TOPICS_READ'] = 'Отметить все темы как прочтённые';
$lang['TOPICS_MARKED_READ'] = 'Все темы в этом форуме были отмечены как прочтённые';
@@ -384,6 +385,11 @@
$lang['ATTACH_SIGNATURE'] = 'Присоединить подпись (можно изменять в профиле)';
$lang['NOTIFY'] = 'Сообщать мне о получении ответа';
+$lang['TO_DRAFT'] = 'Сохранить как черновик';
+$lang['DRAFTS'] = 'Черновиков';
+$lang['CANNOT_DELETE_DRAFT'] = 'Извините, вы не можете удалять чужие черновики';
+$lang['CANNOT_VIEW_DRAFT'] = 'Извините, вы не можете просматривать чужие черновики';
+$lang['NO_DRAFTS'] = 'Список черновиков пуст';
$lang['STORED'] = 'Ваше сообщение было успешно добавлено';
$lang['DELETED'] = 'Ваше сообщение было успешно удалено';
Index: upload/posting.php
===================================================================
--- upload/posting.php (revision 558)
+++ upload/posting.php (working copy)
@@ -318,15 +318,25 @@
require(INC_DIR .'topic_templates.php');
}
-// Notify
+// Notify and draft
+if (!IS_GUEST && $mode != 'newtopic') $post_data['is_draft'] = $post_info['is_draft'];
if ($submit || $refresh)
{
$notify_user = (int) !empty($_POST['notify']);
+ if ($bb_cfg['status_of_draft'] && $post_data['first_post'])
+ {
+ $to_draft = (int) !empty($_POST['to_draft']);
+ }
+ else
+ {
+ $to_draft = ($mode == 'editpost') ? $post_info['is_draft'] : 0;
+ }
}
else
{
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
-
+ $to_draft = ($mode == 'editpost') ? $post_info['is_draft'] : 0;
+
if (!IS_GUEST && $mode != 'newtopic' && !$notify_user)
{
$notify_user = (int) DB()->fetch_row("
@@ -524,8 +534,23 @@
if (!in_array($mode, array('editpost', 'delete', 'poll_delete')))
{
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
+ $post_data['to_draft'] = $to_draft;
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
}
+ if ($mode == 'editpost')
+ {
+ if ($post_info['is_draft'] != $to_draft)
+ {
+ if ($to_draft)
+ {
+ update_draft('is_draft', $forum_id, $topic_id, $post_info['topic_dl_type'], $post_id, $post_data['poster_id']);
+ }
+ else
+ {
+ update_draft('no_draft', $forum_id, $topic_id, $post_info['topic_dl_type'], $post_id, $post_data['poster_id']);
+ }
+ }
+ }
$attachment_mod['posting']->insert_attachment($post_id);
if (!$error_msg && $mode != 'poll_delete')
@@ -538,7 +563,7 @@
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
- if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
+ if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg && !$to_draft)
{
include(INC_DIR .'functions_torrent.php');
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
@@ -847,6 +872,7 @@
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&postorder=desc" : '',
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
+ 'S_DRAFT_CHECKED' => ($to_draft) ? 'checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id,
'S_POST_ACTION' => "posting.php",
@@ -858,6 +884,11 @@
$template->assign_var('POSTING_SUBJECT');
}
+if (($mode == 'newtopic' || $post_data['first_post'] && ($post_info['topic_replies'] == 0 || $post_info['is_draft'])) && $bb_cfg['status_of_draft'])
+{
+ $template->assign_var('DRAFT_CHK');
+}
+
// Update post time
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
{
Index: upload/profile.php
===================================================================
--- upload/profile.php (revision 558)
+++ upload/profile.php (working copy)
@@ -47,6 +47,10 @@
require(INC_DIR . 'ucp/usercp_topic_watch.php');
break;
+ case 'viewdraft':
+ require(INC_DIR . 'ucp/usercp_viewdraft.php');
+ break;
+
default:
bb_die('Invalid mode');
}
\ No newline at end of file
Index: upload/search.php
===================================================================
--- upload/search.php (revision 558)
+++ upload/search.php (working copy)
@@ -465,7 +465,7 @@
// Run initial search for post_ids
if (!$items_found)
{
- $join_t = ($title_match || $my_topics || $new_topics || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl)));
+ $join_t = ($title_match || $my_topics || $new_topics || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl || $bb_cfg['status_of_draft'])));
$join_s = ($text_match_sql && !$title_match);
$join_p = ($my_posts || $join_s);
@@ -497,6 +497,7 @@
if ($prev_days) $SQL['WHERE'][] = "$tbl.$time_field > ". $time_opt[$time_val]['sql'];
if ($my_posts) $SQL['WHERE'][] = "p.poster_id = $poster_id_val";
if ($my_topics) $SQL['WHERE'][] = "t.topic_poster = $poster_id_val";
+ if ($poster_id_val != $user_id && !IS_ADMIN) $SQL['WHERE'][] = "t.is_draft = 0";
if ($text_match_sql)
{
@@ -579,13 +580,14 @@
$topic_id = (int) $topic_id;
$forum_id = (int) $first_post['forum_id'];
$is_unread_t = is_unread($first_post['topic_last_post_time'], $topic_id, $forum_id);
+ $topic_draft = ($first_post['is_draft']) ? $lang['TOPIC_DRAFT'] .' ' : '';
$template->assign_block_vars('t', array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id,
- 'TOPIC_TITLE' => $first_post['topic_title'],
- 'TOPIC_ICON' => get_topic_icon($first_post, $is_unread_t),
+ 'TOPIC_TITLE' => $topic_draft . $first_post['topic_title'],
+ 'TOPIC_ICON' => ($first_post['is_draft']) ? $images['draft'] : get_topic_icon($first_post, $is_unread_t),
));
$quote_btn = true;
@@ -627,7 +629,7 @@
// Run initial search for topic_ids
if (!$items_found)
{
- $join_t = ($title_match || $my_topics || $new_topics || $dl_search || $new_posts || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl)));
+ $join_t = ($title_match || $my_topics || $new_topics || $dl_search || $new_posts || in_array($order_val, array($ord_last_p, $ord_created, $ord_name, $ord_repl || $bb_cfg['status_of_draft'])));
$join_s = ($text_match_sql && !$title_match);
$join_p = ($my_posts || $join_s);
$join_dl = ($dl_search);
@@ -683,6 +685,7 @@
}
}
if ($my_topics) $SQL['WHERE'][] = "t.topic_poster = $poster_id_val";
+ if ($poster_id_val != $user_id && !IS_ADMIN) $SQL['WHERE'][] = "t.is_draft = 0";
if ($text_match_sql)
{
@@ -777,6 +780,7 @@
$forum_id = $topic['forum_id'];
$is_unread = is_unread($topic['topic_last_post_time'], $topic_id, $forum_id);
$moved = ($topic['topic_status'] == TOPIC_MOVED);
+ $topic_draft = ($topic['is_draft']) ? $lang['TOPIC_DRAFT'] .' ' : '';
$template->assign_block_vars('t', array(
'ROW_NUM' => $row_num,
@@ -784,9 +788,9 @@
'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'],
- 'TOPIC_TITLE' => wbr($topic['topic_title']),
+ 'TOPIC_TITLE' => $topic_draft . wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread,
- 'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
+ 'TOPIC_ICON' => ($topic['is_draft']) ? $images['draft'] : get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'],
Index: upload/templates/default/css/main.css
===================================================================
--- upload/templates/default/css/main.css (revision 558)
+++ upload/templates/default/css/main.css (working copy)
@@ -735,6 +735,9 @@
.topicSticky { /* Topic Sticky prefix */
color: #009900;
}
+.topicDraft { /* Topic Draft prefix */
+ font-weight: normal; color: #C63B00;
+}
.topicPoll { /* Topic Poll prefix */
font-weight: normal; color: #006699;
}
Index: upload/templates/default/images/draft.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: upload/templates/default/images/draft.gif
===================================================================
--- upload/templates/default/images/draft.gif (revision 0)
+++ upload/templates/default/images/draft.gif (working copy)
Property changes on: upload/templates/default/images/draft.gif
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: upload/templates/default/page_header.tpl
===================================================================
--- upload/templates/default/page_header.tpl (revision 558)
+++ upload/templates/default/page_header.tpl (working copy)
@@ -472,6 +472,7 @@
{L_SEARCH_DL_COMPLETE_DOWNLOADS}
{L_SEARCH_DL_WILL_DOWNLOADS}
{L_WATCHED_TOPICS}
+ {L_DRAFTS}
Index: upload/templates/default/posting.tpl
===================================================================
--- upload/templates/default/posting.tpl (revision 558)
+++ upload/templates/default/posting.tpl (working copy)
@@ -135,6 +135,14 @@
+
+
| + | + |
| {L_CATEGORY} | +{L_FORUM} | +{L_TOPIC} | +{L_DATE} | +{L_ACTION} | +||||
|---|---|---|---|---|---|---|---|---|
| {DRAFT.CATEGORY} | +{DRAFT.FORUM} | +{DRAFT.TOPIC} | +{DRAFT.DT_CREATE} | +{L_EDIT} | +{L_DELETE} | +Публиковать | +||
| + | ||||||||
{LAST_VISIT_DATE}
+{CURRENT_TIME}
+{S_TIMEZONE}
+