mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 05:13:54 -07:00
r491
Пофиксил проблему на главной с черновиками. Постепенно привожу код к единому виду. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@491 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
5ad8c307a7
commit
a544f1feb7
2 changed files with 247 additions and 371 deletions
|
@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
$bb_cfg['tp_version'] = '2.5 pre-stable';
|
||||||
$bb_cfg['tp_release_date'] = '12-01-2013';
|
$bb_cfg['tp_release_date'] = '13-01-2013';
|
||||||
$bb_cfg['tp_release_state'] = 'R490';
|
$bb_cfg['tp_release_state'] = 'R491';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
|
|
@ -37,8 +37,7 @@ $orig_word = $replacement_word = array();
|
||||||
$topic_type = (@$_POST['topictype']) ? (int)$_POST['topictype'] : POST_NORMAL;
|
$topic_type = (@$_POST['topictype']) ? (int)$_POST['topictype'] : POST_NORMAL;
|
||||||
$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
|
$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
|
||||||
|
|
||||||
if ($mode == 'smilies')
|
if ($mode == 'smilies') {
|
||||||
{
|
|
||||||
generate_smilies('window');
|
generate_smilies('window');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -49,45 +48,35 @@ $tracking_forums = get_tracks('forum');
|
||||||
// Start session management
|
// Start session management
|
||||||
$user->session_start();
|
$user->session_start();
|
||||||
|
|
||||||
if ($mode == 'new_rel')
|
if ($mode == 'new_rel') {
|
||||||
{
|
|
||||||
require(INC_DIR . 'posting_tpl.php');
|
require(INC_DIR . 'posting_tpl.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// What auth type do we need to check?
|
// What auth type do we need to check?
|
||||||
$is_auth = array();
|
$is_auth = array();
|
||||||
switch ($mode)
|
switch ($mode) {
|
||||||
{
|
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
if(bf($userdata['user_opt'], 'user_opt', 'allow_topic'))
|
if (bf($userdata['user_opt'], 'user_opt', 'allow_topic')) {
|
||||||
{
|
|
||||||
bb_die($lang['RULES_POST_CANNOT']);
|
bb_die($lang['RULES_POST_CANNOT']);
|
||||||
}
|
}
|
||||||
if ($topic_type == POST_ANNOUNCE)
|
if ($topic_type == POST_ANNOUNCE) {
|
||||||
{
|
|
||||||
$is_auth_type = 'auth_announce';
|
$is_auth_type = 'auth_announce';
|
||||||
}
|
} else if ($topic_type == POST_STICKY) {
|
||||||
else if ($topic_type == POST_STICKY)
|
|
||||||
{
|
|
||||||
$is_auth_type = 'auth_sticky';
|
$is_auth_type = 'auth_sticky';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$is_auth_type = 'auth_post';
|
$is_auth_type = 'auth_post';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'reply':
|
case 'reply':
|
||||||
case 'quote':
|
case 'quote':
|
||||||
if(bf($userdata['user_opt'], 'user_opt', 'allow_post'))
|
if (bf($userdata['user_opt'], 'user_opt', 'allow_post')) {
|
||||||
{
|
|
||||||
bb_die($lang['RULES_REPLY_CANNOT']);
|
bb_die($lang['RULES_REPLY_CANNOT']);
|
||||||
}
|
}
|
||||||
$is_auth_type = 'auth_reply';
|
$is_auth_type = 'auth_reply';
|
||||||
break;
|
break;
|
||||||
case 'editpost':
|
case 'editpost':
|
||||||
if(bf($userdata['user_opt'], 'user_opt', 'allow_post_edit'))
|
if (bf($userdata['user_opt'], 'user_opt', 'allow_post_edit')) {
|
||||||
{
|
|
||||||
bb_die($lang['RULES_EDIT_CANNOT']);
|
bb_die($lang['RULES_EDIT_CANNOT']);
|
||||||
}
|
}
|
||||||
$is_auth_type = 'auth_edit';
|
$is_auth_type = 'auth_edit';
|
||||||
|
@ -108,11 +97,9 @@ switch ($mode)
|
||||||
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
|
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
|
||||||
$error_msg = '';
|
$error_msg = '';
|
||||||
$post_data = array();
|
$post_data = array();
|
||||||
switch ($mode)
|
switch ($mode) {
|
||||||
{
|
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
if (!$forum_id)
|
if (!$forum_id) {
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['FORUM_NOT_EXIST']);
|
message_die(GENERAL_MESSAGE, $lang['FORUM_NOT_EXIST']);
|
||||||
}
|
}
|
||||||
$sql = "SELECT * FROM " . BB_FORUMS . " WHERE forum_id = $forum_id LIMIT 1";
|
$sql = "SELECT * FROM " . BB_FORUMS . " WHERE forum_id = $forum_id LIMIT 1";
|
||||||
|
@ -120,8 +107,7 @@ switch ($mode)
|
||||||
|
|
||||||
case 'reply':
|
case 'reply':
|
||||||
case 'vote':
|
case 'vote':
|
||||||
if (!$topic_id)
|
if (!$topic_id) {
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_TOPIC_ID']);
|
message_die(GENERAL_MESSAGE, $lang['NO_TOPIC_ID']);
|
||||||
}
|
}
|
||||||
$sql = "SELECT f.*, t.*
|
$sql = "SELECT f.*, t.*
|
||||||
|
@ -135,8 +121,7 @@ switch ($mode)
|
||||||
case 'editpost':
|
case 'editpost':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
case 'poll_delete':
|
case 'poll_delete':
|
||||||
if (!$post_id)
|
if (!$post_id) {
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_POST_ID']);
|
message_die(GENERAL_MESSAGE, $lang['NO_POST_ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,24 +148,19 @@ switch ($mode)
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_VALID_MODE']);
|
message_die(GENERAL_MESSAGE, $lang['NO_VALID_MODE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($post_info = DB()->fetch_row($sql))
|
if ($post_info = DB()->fetch_row($sql)) {
|
||||||
{
|
|
||||||
$forum_id = $post_info['forum_id'];
|
$forum_id = $post_info['forum_id'];
|
||||||
$forum_name = $post_info['forum_name'];
|
$forum_name = $post_info['forum_name'];
|
||||||
|
|
||||||
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
|
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
|
||||||
|
|
||||||
if ($post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
|
if ($post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) {
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['FORUM_LOCKED']);
|
message_die(GENERAL_MESSAGE, $lang['FORUM_LOCKED']);
|
||||||
}
|
} else if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) {
|
||||||
else if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['TOPIC_LOCKED']);
|
message_die(GENERAL_MESSAGE, $lang['TOPIC_LOCKED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete')
|
if ($mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete') {
|
||||||
{
|
|
||||||
$topic_id = $post_info['topic_id'];
|
$topic_id = $post_info['topic_id'];
|
||||||
|
|
||||||
$post_data['poster_post'] = ($post_info['poster_id'] == $userdata['user_id']);
|
$post_data['poster_post'] = ($post_info['poster_id'] == $userdata['user_id']);
|
||||||
|
@ -191,66 +171,50 @@ if ($post_info = DB()->fetch_row($sql))
|
||||||
$post_data['topic_type'] = $post_info['topic_type'];
|
$post_data['topic_type'] = $post_info['topic_type'];
|
||||||
$post_data['poster_id'] = $post_info['poster_id'];
|
$post_data['poster_id'] = $post_info['poster_id'];
|
||||||
|
|
||||||
if ($post_data['first_post'] && $post_data['has_poll'])
|
if ($post_data['first_post'] && $post_data['has_poll']) {
|
||||||
{
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM " . BB_VOTE_DESC . " vd, " . BB_VOTE_RESULTS . " vr
|
FROM " . BB_VOTE_DESC . " vd, " . BB_VOTE_RESULTS . " vr
|
||||||
WHERE vd.topic_id = $topic_id
|
WHERE vd.topic_id = $topic_id
|
||||||
AND vr.vote_id = vd.vote_id
|
AND vr.vote_id = vd.vote_id
|
||||||
ORDER BY vr.vote_option_id";
|
ORDER BY vr.vote_option_id";
|
||||||
|
|
||||||
if (!$result = DB()->sql_query($sql))
|
if (!$result = DB()->sql_query($sql)) {
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$poll_options = array();
|
$poll_options = array();
|
||||||
$poll_results_sum = 0;
|
$poll_results_sum = 0;
|
||||||
if ($row = DB()->sql_fetchrow($result))
|
if ($row = DB()->sql_fetchrow($result)) {
|
||||||
{
|
|
||||||
$poll_title = $row['vote_text'];
|
$poll_title = $row['vote_text'];
|
||||||
$poll_id = $row['vote_id'];
|
$poll_id = $row['vote_id'];
|
||||||
$poll_length = $row['vote_length'] / 86400;
|
$poll_length = $row['vote_length'] / 86400;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
|
$poll_options[$row['vote_option_id']] = $row['vote_option_text'];
|
||||||
$poll_results_sum += $row['vote_result'];
|
$poll_results_sum += $row['vote_result'];
|
||||||
}
|
} while ($row = DB()->sql_fetchrow($result));
|
||||||
while ($row = DB()->sql_fetchrow($result));
|
|
||||||
}
|
}
|
||||||
$post_data['edit_poll'] = ((!$poll_results_sum || $is_auth['auth_mod']) && $post_data['first_post']);
|
$post_data['edit_poll'] = ((!$poll_results_sum || $is_auth['auth_mod']) && $post_data['first_post']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']);
|
$post_data['edit_poll'] = ($post_data['first_post'] && $is_auth['auth_pollcreate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can this user edit/delete the post/poll?
|
// Can this user edit/delete the post/poll?
|
||||||
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'])
|
if ($post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod']) {
|
||||||
{
|
|
||||||
$message = ($delete || $mode == 'delete') ? $lang['DELETE_OWN_POSTS'] : $lang['EDIT_OWN_POSTS'];
|
$message = ($delete || $mode == 'delete') ? $lang['DELETE_OWN_POSTS'] : $lang['EDIT_OWN_POSTS'];
|
||||||
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . TOPIC_URL . $topic_id . '">', '</a>');
|
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . TOPIC_URL . $topic_id . '">', '</a>');
|
||||||
|
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
message_die(GENERAL_MESSAGE, $message);
|
||||||
}
|
} else if (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete)) {
|
||||||
else if (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete))
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_REPLIED']);
|
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_REPLIED']);
|
||||||
}
|
} else if (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete)) {
|
||||||
else if (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete))
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_POLL']);
|
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_POLL']);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if ($mode == 'quote') {
|
||||||
{
|
|
||||||
if ($mode == 'quote')
|
|
||||||
{
|
|
||||||
$topic_id = $post_info['topic_id'];
|
$topic_id = $post_info['topic_id'];
|
||||||
}
|
}
|
||||||
if ($mode == 'newtopic')
|
if ($mode == 'newtopic') {
|
||||||
{
|
|
||||||
$post_data['topic_type'] = POST_NORMAL;
|
$post_data['topic_type'] = POST_NORMAL;
|
||||||
}
|
}
|
||||||
$post_data['first_post'] = ($mode == 'newtopic');
|
$post_data['first_post'] = ($mode == 'newtopic');
|
||||||
|
@ -258,27 +222,21 @@ if ($post_info = DB()->fetch_row($sql))
|
||||||
$post_data['has_poll'] = false;
|
$post_data['has_poll'] = false;
|
||||||
$post_data['edit_poll'] = false;
|
$post_data['edit_poll'] = false;
|
||||||
}
|
}
|
||||||
if ($mode == 'poll_delete' && !$poll_id)
|
if ($mode == 'poll_delete' && !$poll_id) {
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
|
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
|
message_die(GENERAL_MESSAGE, $lang['NO_SUCH_POST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user is not authed, if they're not logged in then redirect
|
// The user is not authed, if they're not logged in then redirect
|
||||||
// them, else show them an error message
|
// them, else show them an error message
|
||||||
if (!$is_auth[$is_auth_type])
|
if (!$is_auth[$is_auth_type]) {
|
||||||
{
|
if (!IS_GUEST) {
|
||||||
if (!IS_GUEST)
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, sprintf($lang['SORRY_' . strtoupper($is_auth_type)], $is_auth[$is_auth_type . '_type']));
|
message_die(GENERAL_MESSAGE, sprintf($lang['SORRY_' . strtoupper($is_auth_type)], $is_auth[$is_auth_type . '_type']));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode) {
|
||||||
{
|
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
$redirect = "mode=newtopic&f=$forum_id";
|
$redirect = "mode=newtopic&f=$forum_id";
|
||||||
break;
|
break;
|
||||||
|
@ -295,10 +253,8 @@ if (!$is_auth[$is_auth_type])
|
||||||
redirect("login.php?redirect=/posting.php?$redirect");
|
redirect("login.php?redirect=/posting.php?$redirect");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id'])
|
if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id']) {
|
||||||
{
|
if ($tor_status = join(',', $bb_cfg['tor_cannot_new'])) {
|
||||||
if($tor_status = join(',', $bb_cfg['tor_cannot_new']))
|
|
||||||
{
|
|
||||||
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
|
$sql = DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
|
||||||
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
|
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
|
||||||
WHERE poster_id = {$userdata['user_id']}
|
WHERE poster_id = {$userdata['user_id']}
|
||||||
|
@ -308,8 +264,7 @@ if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id'])
|
||||||
");
|
");
|
||||||
|
|
||||||
$topics = '';
|
$topics = '';
|
||||||
foreach($sql as $row)
|
foreach ($sql as $row) {
|
||||||
{
|
|
||||||
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
|
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
|
||||||
}
|
}
|
||||||
if ($topics) bb_die($topics . $lang['UNEXECUTED_RELEASE']);
|
if ($topics) bb_die($topics . $lang['UNEXECUTED_RELEASE']);
|
||||||
|
@ -318,17 +273,13 @@ if ($mode == 'newtopic' && $topic_tpl && $post_info['topic_tpl_id'])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
if ($submit || $refresh)
|
if ($submit || $refresh) {
|
||||||
{
|
|
||||||
$notify_user = (int)!empty($_POST['notify']);
|
$notify_user = (int)!empty($_POST['notify']);
|
||||||
$to_draft = (int)!empty($_POST['to_draft']);
|
$to_draft = (int)!empty($_POST['to_draft']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$to_draft = ($bb_cfg['status_of_draft'] && $mode == 'editpost') ? $post_info['is_draft'] : false;
|
$to_draft = ($bb_cfg['status_of_draft'] && $mode == 'editpost') ? $post_info['is_draft'] : false;
|
||||||
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
|
$notify_user = bf($userdata['user_opt'], 'user_opt', 'notify');
|
||||||
if (!IS_GUEST && $mode != 'newtopic' && !$notify_user)
|
if (!IS_GUEST && $mode != 'newtopic' && !$notify_user) {
|
||||||
{
|
|
||||||
$notify_user = (int)DB()->fetch_row("
|
$notify_user = (int)DB()->fetch_row("
|
||||||
SELECT topic_id
|
SELECT topic_id
|
||||||
FROM " . BB_TOPICS_WATCH . "
|
FROM " . BB_TOPICS_WATCH . "
|
||||||
|
@ -345,10 +296,8 @@ execute_posting_attachment_handling();
|
||||||
// если за время пока вы писали ответ, в топике появились новые сообщения, перед тем как ваше сообщение будет отправлено, выводится предупреждение с обзором этих сообщений
|
// если за время пока вы писали ответ, в топике появились новые сообщения, перед тем как ваше сообщение будет отправлено, выводится предупреждение с обзором этих сообщений
|
||||||
$topic_has_new_posts = false;
|
$topic_has_new_posts = false;
|
||||||
|
|
||||||
if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote' || $mode == 'reply') && isset($_COOKIE[COOKIE_TOPIC]))
|
if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote' || $mode == 'reply') && isset($_COOKIE[COOKIE_TOPIC])) {
|
||||||
{
|
if ($topic_last_read = max(intval(@$tracking_topics[$topic_id]), intval(@$tracking_forums[$forum_id]))) {
|
||||||
if ($topic_last_read = max(intval(@$tracking_topics[$topic_id]), intval(@$tracking_forums[$forum_id])))
|
|
||||||
{
|
|
||||||
$sql = "SELECT p.*, pt.post_text, u.username, u.user_rank
|
$sql = "SELECT p.*, pt.post_text, u.username, u.user_rank
|
||||||
FROM " . BB_POSTS . " p, " . BB_POSTS_TEXT . " pt, " . BB_USERS . " u
|
FROM " . BB_POSTS . " p, " . BB_POSTS_TEXT . " pt, " . BB_USERS . " u
|
||||||
WHERE p.topic_id = " . (int)$topic_id . "
|
WHERE p.topic_id = " . (int)$topic_id . "
|
||||||
|
@ -358,12 +307,10 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
|
||||||
ORDER BY p.post_time
|
ORDER BY p.post_time
|
||||||
LIMIT " . $bb_cfg['posts_per_page'];
|
LIMIT " . $bb_cfg['posts_per_page'];
|
||||||
|
|
||||||
if ($rowset = DB()->fetch_rowset($sql))
|
if ($rowset = DB()->fetch_rowset($sql)) {
|
||||||
{
|
|
||||||
$topic_has_new_posts = true;
|
$topic_has_new_posts = true;
|
||||||
|
|
||||||
foreach ($rowset as $i => $row)
|
foreach ($rowset as $i => $row) {
|
||||||
{
|
|
||||||
$template->assign_block_vars('new_posts', array(
|
$template->assign_block_vars('new_posts', array(
|
||||||
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
|
||||||
'POSTER' => profile_url($row),
|
'POSTER' => profile_url($row),
|
||||||
|
@ -385,10 +332,8 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
|
||||||
// --------------------
|
// --------------------
|
||||||
// What shall we do?
|
// What shall we do?
|
||||||
//
|
//
|
||||||
if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
|
if (($delete || $poll_delete || $mode == 'delete') && !$confirm) {
|
||||||
{
|
if (isset($_POST['cancel'])) {
|
||||||
if (isset($_POST['cancel']))
|
|
||||||
{
|
|
||||||
redirect(POST_URL . "$post_id#$post_id");
|
redirect(POST_URL . "$post_id#$post_id");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -404,14 +349,11 @@ if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
|
||||||
'FORM_ACTION' => "posting.php",
|
'FORM_ACTION' => "posting.php",
|
||||||
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
|
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
|
||||||
));
|
));
|
||||||
}
|
} else if ($mode == 'vote') {
|
||||||
else if ( $mode == 'vote' )
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Vote in a poll
|
// Vote in a poll
|
||||||
//
|
//
|
||||||
if ( !empty($_POST['vote_id']) )
|
if (!empty($_POST['vote_id'])) {
|
||||||
{
|
|
||||||
$vote_option_id = intval($_POST['vote_id']);
|
$vote_option_id = intval($_POST['vote_id']);
|
||||||
|
|
||||||
$sql = "SELECT vd.vote_id
|
$sql = "SELECT vd.vote_id
|
||||||
|
@ -420,52 +362,42 @@ else if ( $mode == 'vote' )
|
||||||
AND vr.vote_id = vd.vote_id
|
AND vr.vote_id = vd.vote_id
|
||||||
AND vr.vote_option_id = $vote_option_id
|
AND vr.vote_option_id = $vote_option_id
|
||||||
GROUP BY vd.vote_id";
|
GROUP BY vd.vote_id";
|
||||||
if ( !($result = DB()->sql_query($sql)) )
|
if (!($result = DB()->sql_query($sql))) {
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $vote_info = DB()->sql_fetchrow($result) )
|
if ($vote_info = DB()->sql_fetchrow($result)) {
|
||||||
{
|
|
||||||
$vote_id = $vote_info['vote_id'];
|
$vote_id = $vote_info['vote_id'];
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM " . BB_VOTE_USERS . "
|
FROM " . BB_VOTE_USERS . "
|
||||||
WHERE vote_id = $vote_id
|
WHERE vote_id = $vote_id
|
||||||
AND vote_user_id = " . $userdata['user_id'];
|
AND vote_user_id = " . $userdata['user_id'];
|
||||||
if ( !($result2 = DB()->sql_query($sql)) )
|
if (!($result2 = DB()->sql_query($sql))) {
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !($row = DB()->sql_fetchrow($result2)) )
|
if (!($row = DB()->sql_fetchrow($result2))) {
|
||||||
{
|
|
||||||
$sql = "UPDATE " . BB_VOTE_RESULTS . "
|
$sql = "UPDATE " . BB_VOTE_RESULTS . "
|
||||||
SET vote_result = vote_result + 1
|
SET vote_result = vote_result + 1
|
||||||
WHERE vote_id = $vote_id
|
WHERE vote_id = $vote_id
|
||||||
AND vote_option_id = $vote_option_id";
|
AND vote_option_id = $vote_option_id";
|
||||||
if ( !DB()->sql_query($sql) )
|
if (!DB()->sql_query($sql)) {
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO " . BB_VOTE_USERS . " (vote_id, vote_user_id, vote_user_ip)
|
$sql = "INSERT INTO " . BB_VOTE_USERS . " (vote_id, vote_user_id, vote_user_ip)
|
||||||
VALUES ($vote_id, " . $userdata['user_id'] . ", '" . USER_IP . "')";
|
VALUES ($vote_id, " . $userdata['user_id'] . ", '" . USER_IP . "')";
|
||||||
if ( !DB()->sql_query($sql) )
|
if (!DB()->sql_query($sql)) {
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $lang['VOTE_CAST'];
|
$message = $lang['VOTE_CAST'];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = $lang['ALREADY_VOTED'];
|
$message = $lang['ALREADY_VOTED'];
|
||||||
}
|
}
|
||||||
DB()->sql_freeresult($result2);
|
DB()->sql_freeresult($result2);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = $lang['NO_VOTE_OPTION'];
|
$message = $lang['NO_VOTE_OPTION'];
|
||||||
}
|
}
|
||||||
DB()->sql_freeresult($result);
|
DB()->sql_freeresult($result);
|
||||||
|
@ -473,16 +405,12 @@ else if ( $mode == 'vote' )
|
||||||
meta_refresh("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
|
meta_refresh("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
|
||||||
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . ("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="' . ("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
|
||||||
message_die(GENERAL_MESSAGE, $message);
|
message_die(GENERAL_MESSAGE, $message);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
redirect("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
|
redirect("viewtopic.php?" . POST_TOPIC_URL . "=$topic_id");
|
||||||
}
|
}
|
||||||
}
|
} //snp
|
||||||
//snp
|
|
||||||
// else if ( $submit || $confirm )
|
// else if ( $submit || $confirm )
|
||||||
else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
else if (($submit || $confirm) && !$topic_has_new_posts) //snp end
|
||||||
//snp end
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Submit post/vote (newtopic, edit, reply, etc.)
|
// Submit post/vote (newtopic, edit, reply, etc.)
|
||||||
|
@ -490,8 +418,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
$return_message = '';
|
$return_message = '';
|
||||||
$return_meta = '';
|
$return_meta = '';
|
||||||
|
|
||||||
switch ( $mode )
|
switch ($mode) {
|
||||||
{
|
|
||||||
case 'editpost':
|
case 'editpost':
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
case 'reply':
|
case 'reply':
|
||||||
|
@ -504,8 +431,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
|
|
||||||
prepare_post($mode, $post_data, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length);
|
prepare_post($mode, $post_data, $error_msg, $username, $subject, $message, $poll_title, $poll_options, $poll_length);
|
||||||
|
|
||||||
if (!$error_msg)
|
if (!$error_msg) {
|
||||||
{
|
|
||||||
$topic_type = (isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce']) ? $post_data['topic_type'] : $topic_type;
|
$topic_type = (isset($post_data['topic_type']) && $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce']) ? $post_data['topic_type'] : $topic_type;
|
||||||
|
|
||||||
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), DB()->escape($poll_title), $poll_options, $poll_length, $update_post_time);
|
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, DB()->escape($username), DB()->escape($subject), DB()->escape($message), DB()->escape($poll_title), $poll_options, $poll_length, $update_post_time);
|
||||||
|
@ -519,32 +445,27 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error_msg)
|
if (!$error_msg) {
|
||||||
{
|
if (!in_array($mode, array('editpost', 'delete', 'poll_delete'))) {
|
||||||
if (!in_array($mode, array('editpost', 'delete', 'poll_delete')))
|
|
||||||
{
|
|
||||||
$user_id = ($mode == 'reply' || $mode == 'newtopic') ? $userdata['user_id'] : $post_data['poster_id'];
|
$user_id = ($mode == 'reply' || $mode == 'newtopic') ? $userdata['user_id'] : $post_data['poster_id'];
|
||||||
|
if (!isset($_POST['to_draft'])) {
|
||||||
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
|
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$attachment_mod['posting']->insert_attachment($post_id);
|
$attachment_mod['posting']->insert_attachment($post_id);
|
||||||
|
|
||||||
if (!$error_msg && $mode != 'poll_delete')
|
if (!$error_msg && $mode != 'poll_delete') {
|
||||||
{
|
|
||||||
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
|
user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $post_id, $notify_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'newtopic' || $mode == 'reply')
|
if ($mode == 'newtopic' || $mode == 'reply') {
|
||||||
{
|
|
||||||
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
|
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) {
|
||||||
{
|
|
||||||
include(INC_DIR . 'functions_torrent.php');
|
include(INC_DIR . 'functions_torrent.php');
|
||||||
if(!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
|
if (!DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) {
|
||||||
{
|
if ($bb_cfg['premod']) {
|
||||||
if($bb_cfg['premod'])
|
|
||||||
{
|
|
||||||
// Получение списка id форумов начиная с parent
|
// Получение списка id форумов начиная с parent
|
||||||
$forum_parent = $forum_id;
|
$forum_parent = $forum_id;
|
||||||
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
|
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
|
||||||
|
@ -555,8 +476,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
";
|
";
|
||||||
$count_rowset = DB()->fetch_rowset($count_sql);
|
$count_rowset = DB()->fetch_rowset($count_sql);
|
||||||
$sub_forums = array();
|
$sub_forums = array();
|
||||||
foreach ($count_rowset as $count_row)
|
foreach ($count_rowset as $count_row) {
|
||||||
{
|
|
||||||
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
|
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
|
||||||
}
|
}
|
||||||
$sub_forums[] = $forum_id;
|
$sub_forums[] = $forum_id;
|
||||||
|
@ -573,13 +493,11 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
|
|
||||||
if ($count_checked_releases || IS_AM) tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
if ($count_checked_releases || IS_AM) tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
||||||
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
|
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
|
||||||
}
|
} else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
||||||
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
|
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) {
|
||||||
{
|
|
||||||
$locked_warn = '
|
$locked_warn = '
|
||||||
<div class="warnColor1">
|
<div class="warnColor1">
|
||||||
<b>' . $lang['LOCKED_WARN'] . '</b>
|
<b>' . $lang['LOCKED_WARN'] . '</b>
|
||||||
|
@ -595,8 +513,7 @@ else if ( ($submit || $confirm) && !$topic_has_new_posts )
|
||||||
|
|
||||||
//snp
|
//snp
|
||||||
//if( $refresh || isset($_POST['del_poll_option']) || $error_msg != '' )
|
//if( $refresh || isset($_POST['del_poll_option']) || $error_msg != '' )
|
||||||
if( $refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $topic_has_new_posts) )
|
if ($refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $topic_has_new_posts)) //snp end
|
||||||
//snp end
|
|
||||||
{
|
{
|
||||||
$username = (!empty($_POST['username'])) ? clean_username($_POST['username']) : '';
|
$username = (!empty($_POST['username'])) ? clean_username($_POST['username']) : '';
|
||||||
$subject = (!empty($_POST['subject'])) ? clean_title($_POST['subject']) : '';
|
$subject = (!empty($_POST['subject'])) ? clean_title($_POST['subject']) : '';
|
||||||
|
@ -606,29 +523,22 @@ if( $refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $t
|
||||||
$poll_length = (isset($_POST['poll_length'])) ? max(0, intval($_POST['poll_length'])) : 0;
|
$poll_length = (isset($_POST['poll_length'])) ? max(0, intval($_POST['poll_length'])) : 0;
|
||||||
|
|
||||||
$poll_options = array();
|
$poll_options = array();
|
||||||
if ( !empty($_POST['poll_option_text']) )
|
if (!empty($_POST['poll_option_text'])) {
|
||||||
{
|
|
||||||
# while( list($option_id, $option_text) = @each($_POST['poll_option_text']) )
|
# while( list($option_id, $option_text) = @each($_POST['poll_option_text']) )
|
||||||
foreach ($_POST['poll_option_text'] as $option_id => $option_text)
|
foreach ($_POST['poll_option_text'] as $option_id => $option_text) {
|
||||||
{
|
if (isset($_POST['del_poll_option'][$option_id])) {
|
||||||
if( isset($_POST['del_poll_option'][$option_id]) )
|
|
||||||
{
|
|
||||||
unset($poll_options[$option_id]);
|
unset($poll_options[$option_id]);
|
||||||
}
|
} else if (!empty($option_text)) {
|
||||||
else if ( !empty($option_text) )
|
|
||||||
{
|
|
||||||
$poll_options[$option_id] = clean_title($option_text);
|
$poll_options[$option_id] = clean_title($option_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $poll_add && !empty($_POST['add_poll_option_text']) )
|
if ($poll_add && !empty($_POST['add_poll_option_text'])) {
|
||||||
{
|
|
||||||
$poll_options[] = clean_title($_POST['add_poll_option_text']);
|
$poll_options[] = clean_title($_POST['add_poll_option_text']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($preview)
|
if ($preview) {
|
||||||
{
|
|
||||||
$preview_subject = $subject;
|
$preview_subject = $subject;
|
||||||
$preview_username = $username;
|
$preview_username = $username;
|
||||||
$preview_message = htmlCHR($message, false, ENT_NOQUOTES);
|
$preview_message = htmlCHR($message, false, ENT_NOQUOTES);
|
||||||
|
@ -643,33 +553,24 @@ if( $refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $t
|
||||||
'PREVIEW_MSG' => $preview_message,
|
'PREVIEW_MSG' => $preview_message,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// User default entry point
|
// User default entry point
|
||||||
if ( $mode == 'newtopic' )
|
if ($mode == 'newtopic') {
|
||||||
{
|
|
||||||
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
|
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
|
||||||
$poll_title = '';
|
$poll_title = '';
|
||||||
$poll_length = '';
|
$poll_length = '';
|
||||||
$subject = '';
|
$subject = '';
|
||||||
$message = '';
|
$message = '';
|
||||||
}
|
} else if ($mode == 'reply') {
|
||||||
else if ( $mode == 'reply' )
|
|
||||||
{
|
|
||||||
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
|
$username = ($userdata['session_logged_in']) ? $userdata['username'] : '';
|
||||||
$subject = '';
|
$subject = '';
|
||||||
$message = '';
|
$message = '';
|
||||||
}
|
} else if ($mode == 'quote' || $mode == 'editpost') {
|
||||||
else if ( $mode == 'quote' || $mode == 'editpost' )
|
|
||||||
{
|
|
||||||
$subject = ($post_data['first_post']) ? $post_info['topic_title'] : '';
|
$subject = ($post_data['first_post']) ? $post_info['topic_title'] : '';
|
||||||
$message = $post_info['post_text'];
|
$message = $post_info['post_text'];
|
||||||
|
|
||||||
if ( $mode == 'quote' )
|
if ($mode == 'quote') {
|
||||||
{
|
if (!defined('WORD_LIST_OBTAINED')) {
|
||||||
if (!defined('WORD_LIST_OBTAINED'))
|
|
||||||
{
|
|
||||||
$orig_word = array();
|
$orig_word = array();
|
||||||
$replace_word = array();
|
$replace_word = array();
|
||||||
obtain_word_list($orig_word, $replace_word);
|
obtain_word_list($orig_word, $replace_word);
|
||||||
|
@ -686,45 +587,37 @@ else
|
||||||
// hide sid
|
// hide sid
|
||||||
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]{12}#', 'sid', $message);
|
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]{12}#', 'sid', $message);
|
||||||
|
|
||||||
if ( !empty($orig_word) )
|
if (!empty($orig_word)) {
|
||||||
{
|
|
||||||
$subject = (!empty($subject)) ? preg_replace($orig_word, $replace_word, $subject) : '';
|
$subject = (!empty($subject)) ? preg_replace($orig_word, $replace_word, $subject) : '';
|
||||||
$message = (!empty($message)) ? preg_replace($orig_word, $replace_word, $message) : '';
|
$message = (!empty($message)) ? preg_replace($orig_word, $replace_word, $message) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 )
|
if (!preg_match('/^Re:/', $subject) && strlen($subject) > 0) {
|
||||||
{
|
|
||||||
$subject = 'Re: ' . $subject;
|
$subject = 'Re: ' . $subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = 'reply';
|
$mode = 'reply';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$username = ($post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username'])) ? $post_info['post_username'] : '';
|
$username = ($post_info['user_id'] == ANONYMOUS && !empty($post_info['post_username'])) ? $post_info['post_username'] : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error_msg)
|
if ($error_msg) {
|
||||||
{
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'ERROR_MESSAGE' => $error_msg,
|
'ERROR_MESSAGE' => $error_msg,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_GUEST || ($mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS))
|
if (IS_GUEST || ($mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS)) {
|
||||||
{
|
|
||||||
$template->assign_var('POSTING_USERNAME');
|
$template->assign_var('POSTING_USERNAME');
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Notify checkbox
|
// Notify checkbox
|
||||||
//
|
//
|
||||||
if (!IS_GUEST)
|
if (!IS_GUEST) {
|
||||||
{
|
if ($mode != 'editpost' || ($mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS)) {
|
||||||
if ($mode != 'editpost' || ($mode == 'editpost' && $post_info['poster_id'] != ANONYMOUS))
|
|
||||||
{
|
|
||||||
$template->assign_var('SHOW_NOTIFY_CHECKBOX');
|
$template->assign_var('SHOW_NOTIFY_CHECKBOX');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,42 +626,34 @@ if (!IS_GUEST)
|
||||||
// Topic type selection
|
// Topic type selection
|
||||||
//
|
//
|
||||||
$topic_type_toggle = '';
|
$topic_type_toggle = '';
|
||||||
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])) {
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_type_toggle', array());
|
$template->assign_block_vars('switch_type_toggle', array());
|
||||||
|
|
||||||
if( $is_auth['auth_sticky'] )
|
if ($is_auth['auth_sticky']) {
|
||||||
{
|
|
||||||
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_STICKY . '"';
|
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_STICKY . '"';
|
||||||
if ( isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY) )
|
if (isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY)) {
|
||||||
{
|
|
||||||
$topic_type_toggle .= ' checked="checked"';
|
$topic_type_toggle .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
$topic_type_toggle .= ' /> ' . $lang['POST_STICKY'] . '</label> ';
|
$topic_type_toggle .= ' /> ' . $lang['POST_STICKY'] . '</label> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $is_auth['auth_announce'] )
|
if ($is_auth['auth_announce']) {
|
||||||
{
|
|
||||||
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
|
$topic_type_toggle .= '<label><input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
|
||||||
if ( isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE) )
|
if (isset($post_data['topic_type']) && ($post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE)) {
|
||||||
{
|
|
||||||
$topic_type_toggle .= ' checked="checked"';
|
$topic_type_toggle .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
$topic_type_toggle .= ' /> ' . $lang['POST_ANNOUNCEMENT'] . '</label> ';
|
$topic_type_toggle .= ' /> ' . $lang['POST_ANNOUNCEMENT'] . '</label> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $topic_type_toggle != '' )
|
if ($topic_type_toggle != '') {
|
||||||
{
|
|
||||||
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': <label><input type="radio" name="topictype" value="' . POST_NORMAL . '"' . ((!isset($post_data['topic_type']) || $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL) ? ' checked="checked"' : '') . ' /> ' . $lang['POST_NORMAL'] . '</label> ' . $topic_type_toggle;
|
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': <label><input type="radio" name="topictype" value="' . POST_NORMAL . '"' . ((!isset($post_data['topic_type']) || $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL) ? ' checked="checked"' : '') . ' /> ' . $lang['POST_NORMAL'] . '</label> ' . $topic_type_toggle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//bt
|
//bt
|
||||||
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
|
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0;
|
||||||
|
|
||||||
if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
|
if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod']) {
|
||||||
{
|
if (!$topic_type_toggle) {
|
||||||
if (!$topic_type_toggle)
|
|
||||||
{
|
|
||||||
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
|
$topic_type_toggle = $lang['POST_TOPIC_AS'] . ': ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,8 +661,7 @@ if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
|
||||||
$dl_type_name = 'topic_dl_type';
|
$dl_type_name = 'topic_dl_type';
|
||||||
$dl_type_val = ($topic_dl_type) ? 1 : 0;
|
$dl_type_val = ($topic_dl_type) ? 1 : 0;
|
||||||
|
|
||||||
if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod'])
|
if (!$post_info['allow_reg_tracker'] && !$is_auth['auth_mod']) {
|
||||||
{
|
|
||||||
$dl_ds = ' disabled="disabled" ';
|
$dl_ds = ' disabled="disabled" ';
|
||||||
$dl_hid = '<input type="hidden" name="topic_dl_type" value="' . $dl_type_val . '" />';
|
$dl_hid = '<input type="hidden" name="topic_dl_type" value="' . $dl_type_val . '" />';
|
||||||
$dl_type_name = '';
|
$dl_type_name = '';
|
||||||
|
@ -792,8 +676,7 @@ if ($topic_dl_type || $post_info['allow_reg_tracker'] || $is_auth['auth_mod'])
|
||||||
|
|
||||||
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
$hidden_form_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
||||||
|
|
||||||
switch( $mode )
|
switch ($mode) {
|
||||||
{
|
|
||||||
case 'newtopic':
|
case 'newtopic':
|
||||||
$page_title = $lang['POST_A_NEW_TOPIC'];
|
$page_title = $lang['POST_A_NEW_TOPIC'];
|
||||||
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
|
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
|
||||||
|
@ -826,14 +709,12 @@ $template->assign_vars(array(
|
||||||
'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'])
|
if ($mode == 'newtopic' || $post_data['first_post']) {
|
||||||
{
|
|
||||||
$template->assign_var('POSTING_SUBJECT');
|
$template->assign_var('POSTING_SUBJECT');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update post time
|
// Update post time
|
||||||
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post'])
|
if ($mode == 'editpost' && $post_data['last_post'] && !$post_data['first_post']) {
|
||||||
{
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SHOW_UPDATE_POST_TIME' => ($is_auth['auth_mod'] || ($post_data['poster_post'] && $post_info['post_time'] + 3600 * 3 > TIMENOW)),
|
'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)),
|
'UPDATE_POST_TIME_CHECKED' => ($post_data['poster_post'] && ($post_info['post_time'] + 3600 * 2 > TIMENOW)),
|
||||||
|
@ -863,22 +744,18 @@ $template->assign_vars(array(
|
||||||
//
|
//
|
||||||
// Poll entry switch/output
|
// Poll entry switch/output
|
||||||
//
|
//
|
||||||
if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) ) && $is_auth['auth_pollcreate'] )
|
if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && $is_auth['auth_pollcreate']) {
|
||||||
{
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'POLL_TITLE' => @$poll_title,
|
'POLL_TITLE' => @$poll_title,
|
||||||
'POLL_LENGTH' => @$poll_length)
|
'POLL_LENGTH' => @$poll_length)
|
||||||
);
|
);
|
||||||
|
|
||||||
if( $mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll'])
|
if ($mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll']) {
|
||||||
{
|
|
||||||
$template->assign_block_vars('switch_poll_delete_toggle', array());
|
$template->assign_block_vars('switch_poll_delete_toggle', array());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !empty($poll_options) )
|
if (!empty($poll_options)) {
|
||||||
{
|
while (list($option_id, $option_text) = each($poll_options)) {
|
||||||
while( list($option_id, $option_text) = each($poll_options) )
|
|
||||||
{
|
|
||||||
$template->assign_block_vars('poll_option_rows', array(
|
$template->assign_block_vars('poll_option_rows', array(
|
||||||
'POLL_OPTION' => str_replace('"', '"', $option_text),
|
'POLL_OPTION' => str_replace('"', '"', $option_text),
|
||||||
'S_POLL_OPTION_NUM' => $option_id)
|
'S_POLL_OPTION_NUM' => $option_id)
|
||||||
|
@ -892,8 +769,7 @@ if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) )
|
||||||
//
|
//
|
||||||
// Topic review
|
// Topic review
|
||||||
//
|
//
|
||||||
if( $mode == 'reply' && $is_auth['auth_read'] )
|
if ($mode == 'reply' && $is_auth['auth_read']) {
|
||||||
{
|
|
||||||
topic_review($topic_id);
|
topic_review($topic_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue