mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 00:25:19 +02:00
minor changes, re-added topicreview
git-svn-id: file:///svn/phpbb/trunk@3575 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b5031760af
commit
e42a20b32e
@ -169,7 +169,133 @@ function decode_text(&$message)
|
||||
// Quote Text
|
||||
function quote_text(&$message, $username = '')
|
||||
{
|
||||
$message = ' [quote' . ( (empty($username)) ? ']' : '="]' . addslashes(trim($username)) . '"]') . trim($message) . '[/quote] ';
|
||||
$message = ' [quote' . ( (empty($username)) ? ']' : '="' . addslashes(trim($username)) . '"]') . trim($message) . '[/quote] ';
|
||||
}
|
||||
|
||||
// Topic Review
|
||||
function topic_review($topic_id, $is_inline_review = false)
|
||||
{
|
||||
global $SID, $db, $config, $template, $user, $auth, $phpEx, $phpbb_root_path, $starttime;
|
||||
global $censors;
|
||||
|
||||
// Define censored word matches
|
||||
if (empty($censors))
|
||||
{
|
||||
$censors = array();
|
||||
obtain_word_list($censors);
|
||||
}
|
||||
|
||||
if (!$is_inline_review)
|
||||
{
|
||||
// Get topic info ...
|
||||
$sql = "SELECT t.topic_title, f.forum_id
|
||||
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
|
||||
WHERE t.topic_id = $topic_id
|
||||
AND f.forum_id = t.forum_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
$forum_id = intval($row['forum_id']);
|
||||
$topic_title = $row['topic_title'];
|
||||
|
||||
if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
|
||||
{
|
||||
trigger_error($user->lang['SORRY_AUTH_READ']);
|
||||
}
|
||||
|
||||
if (count($orig_word))
|
||||
{
|
||||
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_INLINE' => true)
|
||||
);
|
||||
}
|
||||
|
||||
// Go ahead and pull all data for this topic
|
||||
$sql = "SELECT u.username, u.user_id, p.*
|
||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
||||
WHERE p.topic_id = $topic_id
|
||||
AND p.poster_id = u.user_id
|
||||
ORDER BY p.post_time DESC
|
||||
LIMIT " . $config['posts_per_page'];
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
// Okay, let's do the loop, yeah come on baby let's do the loop
|
||||
// and it goes like this ...
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$i = 0;
|
||||
do
|
||||
{
|
||||
$poster_id = $row['user_id'];
|
||||
$poster = $row['username'];
|
||||
|
||||
// Handle anon users posting with usernames
|
||||
if($poster_id == ANONYMOUS && $row['post_username'] != '')
|
||||
{
|
||||
$poster = $row['post_username'];
|
||||
$poster_rank = $user->lang['GUEST'];
|
||||
}
|
||||
|
||||
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : '';
|
||||
|
||||
$message = $row['post_text'];
|
||||
|
||||
if ($row['enable_smilies'])
|
||||
{
|
||||
$message = str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
|
||||
}
|
||||
|
||||
if (count($orig_word))
|
||||
{
|
||||
$post_subject = preg_replace($censors['match'], $censors['replace'], $post_subject);
|
||||
$message = preg_replace($censors['match'], $censors['replace'], $message);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'MINI_POST_IMG' => $user->img('goto_post', $user->lang['POST']),
|
||||
'POSTER_NAME' => $poster,
|
||||
'POST_DATE' => $user->format_date($row['post_time']),
|
||||
'POST_SUBJECT' => $post_subject,
|
||||
'MESSAGE' => nl2br($message),
|
||||
|
||||
'S_ROW_COUNT' => $i++)
|
||||
);
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_MESSAGE' => $user->lang['MESSAGE'],
|
||||
'L_POSTED' => $user->lang['POSTED'],
|
||||
'L_POST_SUBJECT'=> $user->lang['POST_SUBJECT'],
|
||||
'L_TOPIC_REVIEW'=> $user->lang['TOPIC_REVIEW'])
|
||||
);
|
||||
|
||||
if (!$is_inline_review)
|
||||
{
|
||||
$page_title = $user->lang['TOPIC_REVIEW'] . ' - ' . $topic_title;
|
||||
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'posting_topic_review.html')
|
||||
);
|
||||
|
||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -415,23 +415,23 @@ class parse_message
|
||||
set_config('num_posts', $config['num_posts'] + 1, TRUE);
|
||||
}
|
||||
|
||||
// Topic notification
|
||||
if (!empty($misc_info['notify']) && ($mode == 'reply' || empty($misc_info['notify_set'])))
|
||||
// Topic Notification
|
||||
if ((!$misc_info['notify_set']) && ($misc_info['notify']))
|
||||
{
|
||||
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id)
|
||||
VALUES (" . $user->data['user_id'] . ", " . $misc_info['topic_id'] . ")";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else if (empty($misc_info['notify']) && !empty($misc_info['notify_set']))
|
||||
else if (($misc_info['notify_set']) && (!$misc_info['notify']))
|
||||
{
|
||||
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
|
||||
WHERE user_id = " . $user->data['user_id'] . "
|
||||
AND topic_id = " . $misc_info['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Mark this topic as read and posted to.
|
||||
$mark_mode = ($mode == 'reply' || $mode == 'post') ? 'post' : 'topic';
|
||||
$mark_mode = ($mode == 'reply' || $mode == 'quote') ? 'post' : 'topic';
|
||||
markread($mark_mode, $misc_info['forum_id'], $misc_info['topic_id'], $misc_info['post_id']);
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
@ -33,7 +33,6 @@
|
||||
// * permission defined ability for user to add poll options
|
||||
// * Spellcheck? aspell? or some such?
|
||||
// * Posting approval
|
||||
// * Report to Admin Checkbox/Button for Moderation ? psoTFX - No, these will be handled by the MCP/viewtopic
|
||||
// * After Submit got clicked, disable the button (prevent double-posts), could be solved in a more elegant way
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
@ -66,13 +65,11 @@ if ($cancel)
|
||||
redirect($redirect);
|
||||
}
|
||||
|
||||
// POST INFO
|
||||
|
||||
// What is all this following SQL for? Well, we need to know
|
||||
// some basic information in all cases before we do anything.
|
||||
$first_validate = false;
|
||||
$second_validate = false;
|
||||
$third_validate = false;
|
||||
$forum_validate = false;
|
||||
$topic_validate = false;
|
||||
$post_validate = false;
|
||||
|
||||
$forum_fields = array('f.forum_id', 'f.forum_name', 'f.parent_id', 'f.forum_parents', 'f.forum_status', 'f.forum_postable', 'f.enable_icons', 'f.enable_post_count', 'f.enable_moderate');
|
||||
$topic_fields = array('t.topic_id', 't.topic_status', 't.topic_first_post_id', 't.topic_last_post_id', 't.topic_type', 't.topic_title');
|
||||
@ -90,7 +87,7 @@ switch ($mode)
|
||||
FROM " . FORUMS_TABLE . " f
|
||||
WHERE forum_id = " . $forum_id;
|
||||
|
||||
$first_validate = true;
|
||||
$forum_validate = true;
|
||||
break;
|
||||
|
||||
case 'reply':
|
||||
@ -104,8 +101,8 @@ switch ($mode)
|
||||
WHERE t.topic_id = " . $topic_id . "
|
||||
AND f.forum_id = t.forum_id";
|
||||
|
||||
$first_validate = true;
|
||||
$second_validate = true;
|
||||
$forum_validate = true;
|
||||
$topic_validate = true;
|
||||
break;
|
||||
|
||||
case 'quote':
|
||||
@ -116,14 +113,24 @@ switch ($mode)
|
||||
trigger_error($user->lang['NO_POST']);
|
||||
}
|
||||
|
||||
$sql = "SELECT " . implode(',', $post_fields) . ", " . implode(',', $topic_fields) . ", " . implode(',', $forum_fields) . "
|
||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
|
||||
$sql = "SELECT " . implode(',', $post_fields) . ", " . implode(',', $topic_fields) . ", " . implode(',', $forum_fields) . ", u.username
|
||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u
|
||||
WHERE p.post_id = " . $post_id . "
|
||||
AND t.topic_id = p.topic_id
|
||||
AND u.user_id = p.poster_id
|
||||
AND f.forum_id = t.forum_id";
|
||||
$first_validate = true;
|
||||
$second_validate = true;
|
||||
$third_validate = true;
|
||||
$forum_validate = true;
|
||||
$topic_validate = true;
|
||||
$post_validate = true;
|
||||
break;
|
||||
|
||||
case 'topicreview':
|
||||
if (!$topic_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
topic_review($topic_id, false);
|
||||
break;
|
||||
|
||||
case 'smilies':
|
||||
@ -143,32 +150,39 @@ if ($sql != '')
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$forum_id = intval($forum_id);
|
||||
$parent_id = ($first_validate) ? intval($parent_id) : false;
|
||||
$forum_parents = ($first_validate) ? trim($forum_parents) : '';
|
||||
$forum_name = ($first_validate) ? trim($forum_name) : '';
|
||||
$forum_status = ($first_validate) ? intval($forum_status) : false;
|
||||
$forum_postable = ($first_validate) ? intval($forum_postable) : false;
|
||||
$enable_post_count = ($first_validate) ? intval($enable_post_count) : false;
|
||||
$enable_moderate = ($first_validate) ? intval($enable_moderate) : false;
|
||||
$enable_icons = ($first_validate) ? intval($enable_icons) : false;
|
||||
$parent_id = ($forum_validate) ? intval($parent_id) : false;
|
||||
$forum_parents = ($forum_validate) ? trim($forum_parents) : '';
|
||||
$forum_name = ($forum_validate) ? trim($forum_name) : '';
|
||||
$forum_status = ($forum_validate) ? intval($forum_status) : false;
|
||||
$forum_postable = ($forum_validate) ? intval($forum_postable) : false;
|
||||
$enable_post_count = ($forum_validate) ? intval($enable_post_count) : false;
|
||||
$enable_moderate = ($forum_validate) ? intval($enable_moderate) : false;
|
||||
$enable_icons = ($forum_validate) ? intval($enable_icons) : false;
|
||||
|
||||
$topic_id = intval($topic_id);
|
||||
$topic_status = ($second_validate) ? intval($topic_status) : false;
|
||||
$topic_first_post_id = ($second_validate) ? intval($topic_first_post_id) : false;
|
||||
$topic_last_post_id = ($second_validate) ? intval($topic_last_post_id) : false;
|
||||
$topic_type = ($second_validate) ? intval($topic_type) : false;
|
||||
$topic_title = ($second_validate) ? trim($topic_title) : '';
|
||||
$topic_status = ($topic_validate) ? intval($topic_status) : false;
|
||||
$topic_first_post_id = ($topic_validate) ? intval($topic_first_post_id) : false;
|
||||
$topic_last_post_id = ($topic_validate) ? intval($topic_last_post_id) : false;
|
||||
$topic_type = ($topic_validate) ? intval($topic_type) : false;
|
||||
$topic_title = ($topic_validate) ? trim($topic_title) : '';
|
||||
|
||||
$post_id = intval($post_id);
|
||||
$post_time = ($third_validate) ? intval($post_time) : false;
|
||||
$poster_id = ($third_validate) ? intval($poster_id) : false;
|
||||
$post_username = ($third_validate) ? trim($post_username) : '';
|
||||
$post_text = ($third_validate) ? trim($post_text) : '';
|
||||
$post_checksum = ($third_validate) ? trim($post_checksum) : '';
|
||||
$bbcode_uid = ($third_validate) ? trim($bbcode_uid) : '';
|
||||
}
|
||||
$post_time = ($post_validate) ? intval($post_time) : false;
|
||||
$poster_id = ($post_validate) ? intval($poster_id) : false;
|
||||
|
||||
if (($poster_id == ANONYMOUS) || (!$poster_id))
|
||||
{
|
||||
$username = ($post_validate) ? trim($post_username) : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = ($post_validate) ? trim($username) : '';
|
||||
}
|
||||
|
||||
// PERMISSION CHECKS
|
||||
$post_text = ($post_validate) ? trim($post_text) : '';
|
||||
$post_checksum = ($post_validate) ? trim($post_checksum) : '';
|
||||
$bbcode_uid = ($post_validate) ? trim($bbcode_uid) : '';
|
||||
}
|
||||
|
||||
// Notify user checkbox
|
||||
if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
|
||||
@ -200,7 +214,7 @@ $perm = array(
|
||||
);
|
||||
|
||||
// DEBUG - Show Permissions
|
||||
debug_print_permissions($perm);
|
||||
//debug_print_permissions($perm);
|
||||
// DEBUG - Show Permissions
|
||||
|
||||
if ( (!$auth->acl_gets('f_' . $mode, 'm_', 'a_', $forum_id)) && ($forum_postable) )
|
||||
@ -245,7 +259,7 @@ if (($submit) || ($preview))
|
||||
$enable_smilies = (!intval($config['allow_smilies'])) ? 0 : ((!empty($_POST['disable_smilies'])) ? 0 : 1);
|
||||
$enable_urls = (!empty($_POST['disable_magic_url'])) ? 0 : 1;
|
||||
$enable_sig = (empty($_POST['attach_sig'])) ? 1 : 0;
|
||||
$notify = (!empty($_POST['notify'])) ? 0 : 1;
|
||||
$notify = (!empty($_POST['notify'])) ? 1 : 0;
|
||||
|
||||
$err_msg = '';
|
||||
$current_time = time();
|
||||
@ -391,9 +405,9 @@ if ($preview)
|
||||
decode_text($post_text);
|
||||
decode_text($subject);
|
||||
|
||||
if ($mode == 'quote')
|
||||
if (($mode == 'quote') && (!$preview))
|
||||
{
|
||||
quote_text($post_text, $post_username);
|
||||
quote_text($post_text, $username);
|
||||
}
|
||||
|
||||
// MAIN POSTING PAGE BEGINS HERE
|
||||
@ -454,6 +468,9 @@ $lock_topic_checked = (isset($topic_lock)) ? $topic_lock : (($topic_status == IT
|
||||
|
||||
// Page title & action URL, include session_id for security purpose
|
||||
$s_action = "posting.$phpEx?sid=" . $user->session_id . "&mode=$mode&f=" . $forum_id;
|
||||
$s_action .= ($topic_id) ? '&t=' . $topic_id : '';
|
||||
$s_action .= ($post_id) ? '&p=' . $post_id : '';
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'post':
|
||||
@ -463,13 +480,11 @@ switch ($mode)
|
||||
case 'quote':
|
||||
case 'reply':
|
||||
$page_title = $user->lang['POST_REPLY'];
|
||||
$s_action .= '&t=' . intval($topic_id);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'edit':
|
||||
$page_title = $user->lang['EDIT_POST'];
|
||||
$s_action .= '&p=' . intval($post_id);
|
||||
break;
|
||||
}
|
||||
|
||||
// Build navigation links
|
||||
@ -492,7 +507,7 @@ $template->assign_vars(array(
|
||||
'FORUM_DESC' => (!empty($forum_desc)) ? strip_tags($forum_desc) : '',
|
||||
'TOPIC_TITLE' => $topic_title,
|
||||
'MODERATORS' => (sizeof($moderators)) ? implode(', ', $moderators[$forum_id]) : $user->lang['NONE'],
|
||||
'USERNAME' => $post_username,
|
||||
'USERNAME' => (((!$preview) && ($mode != 'quote')) || ($preview)) ? stripslashes($username) : '',
|
||||
'SUBJECT' => (!empty($topic_title)) ? $topic_title : $post_subject,
|
||||
'PREVIEW_SUBJECT' => ($preview) ? $preview_subject : '',
|
||||
'MESSAGE' => trim($post_text),
|
||||
@ -508,8 +523,10 @@ $template->assign_vars(array(
|
||||
|
||||
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_id,
|
||||
'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&" . $forum_id . "&t=" . $topic_id : '',
|
||||
'U_REVIEW_TOPIC' => ($mode != 'post') ? "posting.$phpEx$SID&mode=topicreview&f=" . $forum_id . "&t=" . $topic_id : '',
|
||||
|
||||
'S_DISPLAY_PREVIEW' => ($preview),
|
||||
'S_DISPLAY_REVIEW' => ($mode == 'reply' || $mode == 'quote') ? true : false,
|
||||
'S_DISPLAY_USERNAME' => ($user->data['user_id'] == ANONYMOUS || ($mode == 'edit' && $post_username)) ? true : false,
|
||||
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
|
||||
'S_DELETE_ALLOWED' => ($mode == 'edit' && ( ($post_id == $topic_last_post_id && $poster_id == $user->data['user_id'] && $perm['u_delete']) || ($perm['m_delete']))) ? true : false,
|
||||
@ -542,6 +559,12 @@ $template->set_filenames(array(
|
||||
|
||||
make_jumpbox('viewforum.'.$phpEx);
|
||||
|
||||
// Topic review
|
||||
if ($mode == 'reply' || $mode == 'quote')
|
||||
{
|
||||
topic_review($topic_id, true);
|
||||
}
|
||||
|
||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||
|
||||
function debug_print_permissions($perm)
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!-- IF S_DISPLAY_INLINE -->
|
||||
<table class="tablebg" border="0" cellpadding="3" cellspacing="1" width="100%">
|
||||
<tr>
|
||||
<td height="28" align="center"><b>{L_TOPIC_REVIEW}</b></td>
|
||||
<th height="28" align="center">{L_TOPIC_REVIEW}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><iframe width="100%" height="300" src="{U_REVIEW_TOPIC}">
|
||||
|
Loading…
x
Reference in New Issue
Block a user