diff --git a/upload/ajax/posts.php b/upload/ajax/posts.php index 7f526a1f7..6193621ac 100644 --- a/upload/ajax/posts.php +++ b/upload/ajax/posts.php @@ -139,6 +139,10 @@ switch($this->request['type']) } } DB()->query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($text) ."' WHERE post_id = $post_id LIMIT 1"); + if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id']) + { + DB()->query("UPDATE ". BB_POSTS ." SET post_edit_time = '". TIMENOW ."', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1"); + } $s_text = str_replace('\n', "\n", $text); $s_topic_title = str_replace('\n', "\n", $post['topic_title']); add_search_words($post_id, stripslashes($s_text), stripslashes($s_topic_title)); diff --git a/upload/ajax/view_profile.php b/upload/ajax/view_profile.php index 3be0c05e4..a25d0b41c 100644 --- a/upload/ajax/view_profile.php +++ b/upload/ajax/view_profile.php @@ -142,34 +142,12 @@ switch ($mode) $this->response['active_torrents'] = ' - - - - - - - - - - - - - -

'. $lang['CUR_ACTIVE_DLS'] .'

'. $lang['RELEASING'] .': '. $releasing_count .' :: '. $lang['SEEDING'] .': ' . $seeding_count .' :: '. $lang['LEECHING'] .': ' . $leeching_count .'
- -
- - - - - - @@ -186,8 +164,5 @@ switch ($mode)
'. $lang['TYPE'] .'
'; - - - break; } \ No newline at end of file diff --git a/upload/config.php b/upload/config.php index d0f949ad1..64c992c0a 100644 --- a/upload/config.php +++ b/upload/config.php @@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do // Increase number of revision after update $bb_cfg['tp_version'] = '2.5 pre-stable'; -$bb_cfg['tp_release_date'] = '15-05-2013'; -$bb_cfg['tp_release_state'] = 'R500'; +$bb_cfg['tp_release_date'] = '22-05-2013'; +$bb_cfg['tp_release_state'] = 'R501'; // Database $charset = 'utf8'; diff --git a/upload/includes/functions_post.php b/upload/includes/functions_post.php index 7d9ca4773..406dbd6eb 100644 --- a/upload/includes/functions_post.php +++ b/upload/includes/functions_post.php @@ -388,7 +388,10 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u } else if ($mode != 'poll_delete') { - $forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : ""); + if (!$post_data['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 @@ -396,12 +399,15 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u $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 (!$post_data['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 != '') @@ -415,8 +421,21 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u } } - if ($mode != 'poll_delete') + if ($mode != 'poll_delete' || $post_data['to_draft']) { + $sql = "SELECT forum_postcount + FROM " . BB_FORUMS . " + WHERE forum_id = $forum_id + AND forum_postcount = 0"; + if (!$result = DB()->sql_query($sql)) + { + message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql); + } + if ($row = DB()->sql_fetchrow($result)) + { + return; + } + $sql = "UPDATE " . BB_USERS . " SET user_posts = user_posts $sign WHERE user_id = $user_id"; @@ -427,6 +446,67 @@ function update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $u } } +// +// 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 // diff --git a/upload/includes/ucp/usercp_viewdraft.php b/upload/includes/ucp/usercp_viewdraft.php index 261ffc754..f1602398f 100644 --- a/upload/includes/ucp/usercp_viewdraft.php +++ b/upload/includes/ucp/usercp_viewdraft.php @@ -8,7 +8,7 @@ if (!$profiledata = get_userdata($_GET[POST_USERS_URL])) bb_die($lang['NO_USER_I if (!$userdata['session_logged_in']) redirect("login.php?redirect={$_SERVER['REQUEST_URI']}"); -if ($profiledata['user_id'] != $userdata['user_id'] && !IS_ADMIN) bb_die('Ты ноги мыла, Дездемона? :)'); +if ($profiledata['user_id'] != $userdata['user_id'] && !IS_ADMIN) bb_die($lang['CANNOT_VIEW_DRAFT']); $sql = " SELECT t.*, f.forum_name, f.cat_id, f.forum_parent AS parent_id, f2.forum_name AS parent_name, c.cat_title diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php index b5304df07..cd560b72b 100644 --- a/upload/includes/ucp/usercp_viewprofile.php +++ b/upload/includes/ucp/usercp_viewprofile.php @@ -128,6 +128,7 @@ $template->assign_vars(array( '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'], diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php index e6b99a435..b6546b4ed 100644 --- a/upload/language/lang_english/lang_main.php +++ b/upload/language/lang_english/lang_main.php @@ -385,6 +385,7 @@ $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['STORED'] = 'Your message has been entered successfully.'; $lang['DELETED'] = 'Your message has been deleted successfully.'; @@ -564,7 +565,6 @@ $lang['HIDE_PORN_FORUMS'] = 'Hide porno forums'; $lang['ALWAYS_NOTIFY'] = 'Always notify me of replies'; $lang['ALWAYS_NOTIFY_EXPLAIN'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.'; -$lang['BOARD_STYLE'] = 'Board Style'; $lang['BOARD_LANG'] = 'Board Language'; $lang['GENDER'] = 'Gender'; $lang['GENDER_SELECT'] = array( @@ -1346,6 +1346,7 @@ $lang['ONLY_1_TOR_PER_TOPIC'] = 'You can register only one torrent in one topic' $lang['VIEWING_USER_BT_PROFILE'] = 'Viewing torrent-profile :: %s'; // %s is username $lang['CUR_ACTIVE_DLS'] = 'Currently active torrents'; $lang['CUR_ACTIVE_DLS_ERROR'] = 'User does not download and seeding'; +$lang['CUR_ACTIVE_DLS_DISALLOWED'] = 'Browse the user denied active torrents'; $lang['TD_TRAF'] = 'Today'; $lang['YS_TRAF'] = 'Yesterday'; diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php index a0d379e43..2b4728e40 100644 --- a/upload/language/lang_russian/lang_main.php +++ b/upload/language/lang_russian/lang_main.php @@ -387,6 +387,7 @@ $lang['NOTIFY'] = 'Сообщать мне о получении ответа'; $lang['TO_DRAFT'] = 'Сохранить как черновик'; $lang['DRAFTS'] = 'Черновиков'; $lang['CANNOT_DELETE_DRAFT'] = 'Извините, вы не можете удалять чужие черновики'; +$lang['CANNOT_VIEW_DRAFT'] = 'Извините, вы не можете просматривать чужие черновики'; $lang['STORED'] = 'Ваше сообщение было успешно добавлено'; $lang['DELETED'] = 'Ваше сообщение было успешно удалено'; @@ -567,7 +568,6 @@ $lang['HIDE_PORN_FORUMS'] = 'Скрыть pron форумы'; $lang['ALWAYS_NOTIFY'] = 'Всегда сообщать мне об ответах'; $lang['ALWAYS_NOTIFY_EXPLAIN'] = 'Когда кто-нибудь ответит на тему, в которую вы писали, вам высылается e-mail. Это можно также настроить при размещении сообщения.'; -$lang['BOARD_STYLE'] = 'Внешний вид форумов'; $lang['BOARD_LANG'] = 'Язык'; $lang['GENDER'] = 'Пол'; $lang['GENDER_SELECT'] = array( @@ -1349,6 +1349,7 @@ $lang['ONLY_1_TOR_PER_TOPIC'] = 'Вы не можете зарегистриро $lang['VIEWING_USER_BT_PROFILE'] = 'Торрент-профиль'; // %s is username $lang['CUR_ACTIVE_DLS'] = 'Текущие активные торренты'; $lang['CUR_ACTIVE_DLS_ERROR'] = 'Пользователь ничего не скачивает и не сидирует'; +$lang['CUR_ACTIVE_DLS_DISALLOWED'] = 'Пользователь запретил просматривать его активные торренты'; $lang['TD_TRAF'] = 'Сегодня'; $lang['YS_TRAF'] = 'Вчера'; diff --git a/upload/posting.php b/upload/posting.php index c1d44528b..a94ba7dad 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -326,7 +326,7 @@ if ($submit || $refresh) else { $notify_user = bf($userdata['user_opt'], 'user_opt', 'notify'); - $to_draft = ($bb_cfg['status_of_draft'] && $mode == 'editpost') ? $post_info['is_draft'] : false; + $to_draft = ($mode == 'editpost') ? $post_info['is_draft'] : false; if (!IS_GUEST && $mode != 'newtopic' && !$notify_user) { @@ -525,14 +525,8 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts ) if (!in_array($mode, array('editpost', 'delete', 'poll_delete'))) { $user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id']; - if (!$to_draft) - { - update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); - } - else - { - update_post_stats('delete', $post_data, $forum_id, $topic_id, $post_id, $user_id); - } + $post_data['to_draft'] = $to_draft; + update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id); } if ($mode == 'editpost') { @@ -540,11 +534,11 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts ) { if ($to_draft) { - update_post_stats('delete', $post_data, $forum_id, $topic_id, $post_id, $post_data['poster_id']); + update_draft('is_draft', $forum_id, $topic_id, $post_id, $post_data['poster_id']); } else { - update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $post_data['poster_id']); + update_draft('no_draft', $forum_id, $topic_id, $post_id, $post_data['poster_id']); } } } @@ -560,7 +554,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts ) 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)) @@ -839,34 +833,18 @@ $template->set_filenames(array( 'body' => 'posting.tpl', )); +// +// Output the data to the template +// + $template->assign_vars(array( 'FORUM_NAME' => htmlCHR($forum_name), 'PAGE_TITLE' => $page_title, 'POSTING_TYPE_TITLE' => $page_title, 'POSTING_TOPIC_ID' => ($mode != 'newtopic') ? $topic_id : '', 'POSTING_TOPIC_TITLE' => ($mode != 'newtopic') ? wbr($post_info['topic_title']) : '', - 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id") -); + 'U_VIEW_FORUM' => "viewforum.php?" . POST_FORUM_URL . "=$forum_id", -if ($mode == 'newtopic' || $post_data['first_post']) -{ - $template->assign_var('POSTING_SUBJECT'); -} - -// Update post time -if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) -{ - $template->assign_vars(array( - 'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600*3 > TIMENOW)), - 'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600*2 > TIMENOW)), - )); -} - -// -// Output the data to the template -// - -$template->assign_vars(array( 'USERNAME' => @$username, 'CAPTCHA_HTML' => (IS_GUEST) ? CAPTCHA()->get_html() : '', 'SUBJECT' => $subject, @@ -882,6 +860,25 @@ $template->assign_vars(array( 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields) ); +if ($mode == 'newtopic' || $post_data['first_post']) +{ + $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']) +{ + $template->assign_vars(array( + 'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600*3 > TIMENOW)), + 'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600*2 > TIMENOW)), + )); +} + // // Poll entry switch/output // diff --git a/upload/search.php b/upload/search.php index ce5b2ec83..68de9068f 100644 --- a/upload/search.php +++ b/upload/search.php @@ -476,7 +476,7 @@ if ($post_mode) $SQL['SELECT'][] = ($join_t && !$join_p) ? 't.topic_first_post_id AS item_id' : 'p.post_id AS item_id'; // FROM - if ($join_t) $SQL['FROM'][] = $topics_tbl; + if ($join_t || $bb_cfg['status_of_draft']) $SQL['FROM'][] = $topics_tbl; if ($join_p) $SQL['FROM'][] = $posts_tbl; if (!$SQL['FROM']) @@ -497,6 +497,7 @@ if ($post_mode) 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 && $bb_cfg['status_of_draft']) $SQL['WHERE'][] = "t.is_draft = 0"; if ($text_match_sql) { @@ -579,13 +580,14 @@ if ($post_mode) $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; @@ -646,7 +648,7 @@ else } // FROM - if ($join_t) $SQL['FROM'][] = $topics_tbl; + if ($join_t || $bb_cfg['status_of_draft']) $SQL['FROM'][] = $topics_tbl; if ($join_p) $SQL['FROM'][] = $posts_tbl; if (!$SQL['FROM']) @@ -683,6 +685,7 @@ else } } if ($my_topics) $SQL['WHERE'][] = "t.topic_poster = $poster_id_val"; + if ($poster_id_val != $user_id && !IS_ADMIN && $bb_cfg['status_of_draft']) $SQL['WHERE'][] = "t.is_draft = 0"; if ($text_match_sql) { @@ -777,6 +780,7 @@ else $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 @@ else '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'], diff --git a/upload/templates/default/images/draft.gif b/upload/templates/default/images/draft.gif new file mode 100644 index 000000000..9225a1b1b Binary files /dev/null and b/upload/templates/default/images/draft.gif differ diff --git a/upload/templates/default/posting.tpl b/upload/templates/default/posting.tpl index 1941d46eb..dcfe69c1d 100644 --- a/upload/templates/default/posting.tpl +++ b/upload/templates/default/posting.tpl @@ -135,12 +135,14 @@ +
+ diff --git a/upload/templates/default/tpl_config.php b/upload/templates/default/tpl_config.php index 0f57ebf72..2f918a06d 100644 --- a/upload/templates/default/tpl_config.php +++ b/upload/templates/default/tpl_config.php @@ -55,6 +55,7 @@ $images['folder_dl'] = $_main .'folder_dl.gif'; $images['folder_dl_new'] = $_main .'folder_dl_new.gif'; $images['folder_dl_hot'] = $_main .'folder_dl_hot.gif'; $images['folder_dl_hot_new'] = $_main .'folder_dl_hot_new.gif'; +$images['draft'] = $_main .'draft.gif'; // attach_icons $images['icon_clip'] = $_img .'icon_clip.gif'; diff --git a/upload/templates/default/usercp_viewprofile.tpl b/upload/templates/default/usercp_viewprofile.tpl index 3fa70d4e8..b14f1ac1a 100644 --- a/upload/templates/default/usercp_viewprofile.tpl +++ b/upload/templates/default/usercp_viewprofile.tpl @@ -415,7 +415,7 @@ ajax.callback.view_profile = function(data) { {L_ACCESS_SRV_LOAD}: {IGNORE_SRV_LOAD} - + {L_DRAFTS}: {COUNT_DRAFT} diff --git a/upload/viewforum.php b/upload/viewforum.php index 351357e81..aa9c7152f 100644 --- a/upload/viewforum.php +++ b/upload/viewforum.php @@ -519,7 +519,7 @@ foreach ($topic_rowset as $topic) 'TOPIC_TITLE' => $topic_draft . wbr($topic['topic_title']), 'TOPICS_SEPARATOR' => $separator, '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, $replies, $bb_cfg['posts_per_page']), 'REPLIES' => $replies, 'VIEWS' => $topic['topic_views'], diff --git a/upload/viewtopic.php b/upload/viewtopic.php index e2c59ab74..229f1ce4e 100644 --- a/upload/viewtopic.php +++ b/upload/viewtopic.php @@ -113,6 +113,11 @@ if (!$t_data = DB()->fetch_row($sql)) bb_die($lang['TOPIC_POST_NOT_EXIST']); } +if($t_data['topic_poster'] != $userdata['user_id'] && $t_data['is_draft'] && !IS_ADMIN) +{ + bb_die($lang['CANNOT_VIEW_DRAFT']); +} + $forum_topic_data =& $t_data; $topic_id = $t_data['topic_id']; $forum_id = $t_data['forum_id']; @@ -457,8 +462,8 @@ $view_forum_url = "viewforum.php?f=$forum_id"; $view_prev_topic_url = "viewtopic.php?t=$topic_id&view=previous#newest"; $view_next_topic_url = "viewtopic.php?t=$topic_id&view=next#newest"; -$reply_img = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new']; -$reply_alt = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED ) ? $lang['TOPIC_LOCKED_SHORT'] : $lang['REPLY_TO_TOPIC']; +$reply_img = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED || $t_data['is_draft'] ) ? $images['reply_locked'] : $images['reply_new']; +$reply_alt = ( $t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED || $t_data['is_draft'] ) ? $lang['TOPIC_LOCKED_SHORT'] : $lang['REPLY_TO_TOPIC']; // Set 'body' template for attach_mod $template->set_filenames(array('body' => 'viewtopic.tpl')); @@ -1076,7 +1081,7 @@ if (defined('SPLIT_FORM_START')) // if ($bb_cfg['show_quick_reply']) { - if ($is_auth['auth_reply'] && !($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED)) + if ($is_auth['auth_reply'] && !($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED) && !$t_data['is_draft']) { $template->assign_vars(array( 'QUICK_REPLY' => true,