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']}&amp;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 @@
+<?php
+
+if (!defined('BB_ROOT')) die(basename(__FILE__));
+
+if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID) bb_die($lang['NO_USER_ID_SPECIFIED']);
+
+if (!$profiledata = get_userdata($_GET[POST_USERS_URL])) bb_die($lang['NO_USER_ID_SPECIFIED']);
+
+if (!$userdata['session_logged_in']) redirect("login.php?redirect={$_SERVER['REQUEST_URI']}");
+
+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
+	FROM ". BB_TOPICS." t
+	LEFT JOIN ". BB_FORUMS." f ON (f.forum_id = t.forum_id)
+	LEFT JOIN ". BB_CATEGORIES." c ON (f.cat_id = c.cat_id)
+	LEFT JOIN ". BB_FORUMS." f2 ON (f.forum_parent = f2.forum_id)
+	WHERE t.topic_poster = ". $profiledata['user_id'] ."
+	AND t.is_draft = 1
+";
+
+if(!$rows = DB()->fetch_rowset($sql))
+{
+	bb_die($lang['NO_DRAFTS'] . '<br /><br /><a href="'. PROFILE_URL . $profiledata['user_id'] .'">'. $lang['RETURN_PROFILE'] .'</a><br /><br />'. sprintf($lang['CLICK_RETURN_INDEX'],  '<a href="index.php">', '</a>'));
+}
+
+$i = 0;
+foreach ($rows as $row)
+{
+	$category = '<a href="'. CAT_URL .  $row['cat_id'] .'">'. $row['cat_title'] .'</a>';
+	$forum = '<a href="'. FORUM_URL . $row['forum_id'] .'">'. $row['forum_name'] .'</a>';
+	$topic = '<a href="'. TOPIC_URL . $row['topic_id'] .'">'. $row['topic_title'] .'</a>';
+
+	if($row["parent_id"] != 0) $forum .= '&nbsp;<em>&raquo;</em>&nbsp;<a href="'. FORUM_URL . $row['parent_id'] .'">'. $row['parent_name'] .'</a>';
+
+	$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&amp;uid={$profiledata['user_id']}",
 	'U_SEARCH_TOPICS'      => "search.php?uid={$profiledata['user_id']}&amp;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&amp;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 @@
 		<a class="med" href="{U_SEARCH}?dlu={SESSION_USER_ID}&dlc=1">{L_SEARCH_DL_COMPLETE_DOWNLOADS}</a>
 		<a class="med" href="{U_SEARCH}?dlu={SESSION_USER_ID}&dlw=1">{L_SEARCH_DL_WILL_DOWNLOADS}</a>
 		<a class="med" href="{U_WATCHED_TOPICS}">{L_WATCHED_TOPICS}</a>
+		<!-- IF $bb_cfg['status_of_draft'] --><a class="med" href="{U_MY_DRAFTS}">{L_DRAFTS}</a><!-- ENDIF -->
 	</div>
 </div>
 <!-- ELSE -->
Index: upload/templates/default/posting.tpl
===================================================================
--- upload/templates/default/posting.tpl	(revision 558)
+++ upload/templates/default/posting.tpl	(working copy)
@@ -135,6 +135,14 @@
 		</tr>
 		<!-- ENDIF -->
 		</table>
+		<!-- IF DRAFT_CHK -->
+		<table class="borderless inline">
+		<tr>
+			<td><input type="checkbox" id="to_draft" name="to_draft" {S_DRAFT_CHECKED} /></td>
+			<td><label for="to_draft">{L_TO_DRAFT}</label></td>
+		</tr>
+		</table>
+		<!-- ENDIF -->
 	</div>
 	</td>
 </tr>
Index: upload/templates/default/tpl_config.php
===================================================================
--- upload/templates/default/tpl_config.php	(revision 558)
+++ upload/templates/default/tpl_config.php	(working copy)
@@ -55,6 +55,7 @@
 $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';
Index: upload/templates/default/usercp_viewdraft.tpl
===================================================================
--- upload/templates/default/usercp_viewdraft.tpl	(revision 0)
+++ upload/templates/default/usercp_viewdraft.tpl	(working copy)
@@ -0,0 +1,64 @@
+<script type="text/javascript">
+	ajax.modify_draft = function (tid, mode) {
+		var _mode = (!mode) ? 0 : 1;
+
+		ajax.exec({
+			action		: "modify_draft",
+			id_draft	: tid,
+			mode		: _mode
+		});
+	};
+
+	ajax.callback.modify_draft = function (data) {
+		jQuery("tr#tr_" + data.tid).remove();
+	};
+</script>
+
+<h1 class="pagetitle">{PAGE_TITLE}</h1>
+
+<p class="nav"><a href="{U_INDEX}">{T_INDEX}</a>&nbsp;<em>&raquo;</em>&nbsp;{PROFILE}</p>
+
+<table class="bordered w100">
+	<thead>
+	<tr>
+		<th class="thHead">{L_CATEGORY}</th>
+		<th class="thHead">{L_FORUM}</th>
+		<th class="thHead">{L_TOPIC}</th>
+		<th class="thHead">{L_DATE}</th>
+		<th class="thHead" colspan="3">{L_ACTION}</th>
+	</tr>
+	</thead>
+	<tbody>
+	<!-- BEGIN DRAFT -->
+	<tr id="tr_{DRAFT.TOPIC_ID}">
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8">{DRAFT.CATEGORY}</td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8">{DRAFT.FORUM}</td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8">{DRAFT.TOPIC}</td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8">{DRAFT.DT_CREATE}</td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8"><a href="{DRAFT.EDIT_POST}">{L_EDIT}</a></td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8"><a href="javascript: void(0)" onclick="ajax.modify_draft({DRAFT.TOPIC_ID})">{L_DELETE}</a></td>
+		<td class="row{DRAFT.ROW_CLASS} tCenter pad_8"><a href="javascript: void(0)" onclick="ajax.modify_draft({DRAFT.TOPIC_ID}, true);">Публиковать</a></td>
+	</tr>
+	<!-- END DRAFT -->
+	</tbody>
+	<tfoot>
+	<tr>
+		<td class="catBottom" colspan="9">&nbsp;</td>
+	</tr>
+	</tfoot>
+</table>
+
+<div class="bottom_info">
+	<div class="nav">
+		<p style="float: left"></p>
+		<p style="float: right"></p>
+		<div class="clear"></div>
+	</div>
+	<div class="spacer_4"></div>
+	<div id="timezone">
+		<p>{LAST_VISIT_DATE}</p>
+		<p>{CURRENT_TIME}</p>
+		<p>{S_TIMEZONE}</p>
+	</div>
+	<div class="clear"></div>
+</div><!--/bottom_info-->
\ No newline at end of file
Index: upload/templates/default/usercp_viewprofile.tpl
===================================================================
--- upload/templates/default/usercp_viewprofile.tpl	(revision 558)
+++ upload/templates/default/usercp_viewprofile.tpl	(working copy)
@@ -405,6 +405,12 @@
 				<td><b>{AGE}</b></td>
 			</tr>
 			<!-- ENDIF -->
+			<!-- IF SHOW_DRAFT -->
+			<tr>
+				<th>{L_DRAFTS}:</th>
+				<td><a href="{U_DRAFTS}"><b>{COUNT_DRAFT}</b></a></td>
+			</tr>
+			<!-- ENDIF -->
 		    <tr>
 			    <td colspan="2" class="pad_4">
 
Index: upload/templates/default/viewforum.tpl
===================================================================
--- upload/templates/default/viewforum.tpl	(revision 558)
+++ upload/templates/default/viewforum.tpl	(working copy)
@@ -458,6 +458,7 @@
 		<!-- IF t.STATUS == MOVED --><span class="topicMoved">{L_TOPIC_MOVED}</span>
 			<!-- ELSEIF t.DL_CLASS --><span class="{t.DL_CLASS} iconDL"><b>{L_TOPIC_DL}</b></span>
 		<!-- ENDIF -->
+		<!-- IF t.IS_DRAFT --><span class="topicDraft">{L_TOPIC_DRAFT}</span><!-- ENDIF -->
 		<!-- IF t.POLL --><span class="topicPoll">{L_TOPIC_POLL}</span><!-- ENDIF -->
 		<!-- IF t.TOR_STALED || t.TOR_FROZEN -->
 			<!-- IF t.ATTACH --><span>{TOPIC_ATTACH_ICON}</span><!-- ENDIF -->
@@ -559,6 +560,7 @@
 				<!-- ELSEIF t.DL --><span class="">{L_TOPIC_DL}</span>
 				<!-- ELSEIF t.ATTACH -->{TOPIC_ATTACH_ICON}
 			<!-- ENDIF -->
+			<!-- IF t.IS_DRAFT --><span class="topicDraft">{L_TOPIC_DRAFT}</span><!-- ENDIF -->
 			<!-- IF t.POLL --><span class="topicPoll">{L_TOPIC_POLL}</span><!-- ENDIF -->
 			<a id="tt-{t.TOPIC_ID}" href="{TOPIC_URL}{t.HREF_TOPIC_ID}" class="topictitle tt-text">{t.TOPIC_TITLE}</a>
 		</span>
Index: upload/viewforum.php
===================================================================
--- upload/viewforum.php	(revision 558)
+++ upload/viewforum.php	(working copy)
@@ -278,6 +278,7 @@
 			SELECT COUNT(*) AS forum_topics
 			FROM ". BB_TOPICS ."
 			WHERE forum_id = $forum_id
+				AND is_draft != 1
 				AND topic_last_post_time > ". (TIMENOW - 86400*$req_topic_days) ."
 		";
 
@@ -462,6 +463,11 @@
 $found_topics = 0;
 foreach ($topic_rowset as $topic)
 {
+	if ($topic['is_draft'] && $topic['first_user_id'] != $userdata['user_id'])
+	{
+		continue;
+	}
+
 	$topic_id = $topic['topic_id'];
 	$moved    = ($topic['topic_status'] == TOPIC_MOVED);
 	$replies  = $topic['topic_replies'];
@@ -511,7 +517,7 @@
 		'TOPIC_TITLE'      => 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'],
@@ -526,6 +532,7 @@
 		'STATUS'           => $topic['topic_status'],
 		'TYPE'             => $topic['topic_type'],
 		'DL'               => ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL && !$forum_data['allow_reg_tracker']),
+		'IS_DRAFT'		   => $topic['is_draft'],
 		'POLL'             => $topic['topic_vote'],
 		'DL_CLASS'         => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '',
 
Index: upload/viewtopic.php
===================================================================
--- upload/viewtopic.php	(revision 558)
+++ upload/viewtopic.php	(working copy)
@@ -113,6 +113,11 @@
 	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_prev_topic_url = "viewtopic.php?t=$topic_id&amp;view=previous#newest";
 $view_next_topic_url = "viewtopic.php?t=$topic_id&amp;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'));
@@ -1019,7 +1024,7 @@
 // Quick Reply
 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,
