mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 14:48:28 +01:00
Generally related to post tables merge
git-svn-id: file:///svn/phpbb/trunk@3538 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
dca34f5db9
commit
5b0d02baa2
@ -200,22 +200,6 @@ function bbencode_second_pass($text, $uid, $enable_img = true)
|
||||
$replacements[0] = $bbcode_tpl['img'];
|
||||
}
|
||||
|
||||
// [url]xxxx://www.phpbb.com[/url] code..
|
||||
$patterns[1] = "#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)\[/url\]#si";
|
||||
$replacements[1] = $bbcode_tpl['url1'];
|
||||
|
||||
// [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
|
||||
$patterns[2] = "#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)\[/url\]#si";
|
||||
$replacements[2] = $bbcode_tpl['url2'];
|
||||
|
||||
// [url=xxxx://www.phpbb.com]phpBB[/url] code..
|
||||
$patterns[3] = "#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)\](.*?)\[/url\]#si";
|
||||
$replacements[3] = $bbcode_tpl['url3'];
|
||||
|
||||
// [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
|
||||
$patterns[4] = "#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)\](.*?)\[/url\]#si";
|
||||
$replacements[4] = $bbcode_tpl['url4'];
|
||||
|
||||
// [email]user@domain.tld[/email] code..
|
||||
$patterns[5] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
|
||||
$replacements[5] = $bbcode_tpl['email'];
|
||||
@ -600,48 +584,6 @@ function bbencode_second_pass_code($text, $uid, $bbcode_tpl)
|
||||
|
||||
} // bbencode_second_pass_code()
|
||||
|
||||
/**
|
||||
* Rewritten by Nathan Codding - Feb 6, 2001.
|
||||
* - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking
|
||||
* to that URL
|
||||
* - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking
|
||||
* to http://www.xxxx.yyyy[/zzzz]
|
||||
* - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking
|
||||
* to that email address
|
||||
* - Only matches these 2 patterns either after a space, or at the beginning of a line
|
||||
*
|
||||
* Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
|
||||
* have it require something like xxxx@yyyy.zzzz or such. We'll see.
|
||||
*/
|
||||
function make_clickable($text)
|
||||
{
|
||||
|
||||
// pad it with a space so we can match things at the start of the 1st line.
|
||||
$ret = " " . $text;
|
||||
|
||||
// matches an "xxxx://yyyy" URL at the start of a line, or after a space.
|
||||
// xxxx can only be alpha characters.
|
||||
// yyyy is anything up to the first space, newline, or comma.
|
||||
$ret = preg_replace("#([\n ])([a-z]+?)://([^\t <\n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
|
||||
|
||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||
// Must contain at least 2 dots. xxxx contains either alphanum, or "-"
|
||||
// yyyy contains either alphanum, "-", or "."
|
||||
// zzzz is optional.. will contain everything up to the first space, newline, or comma.
|
||||
// This is slightly restrictive - it's not going to match stuff like "forums.foo.com"
|
||||
// This is to keep it from getting annoying and matching stuff that's not meant to be a link.
|
||||
$ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^\t <\n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
|
||||
|
||||
// matches an email@domain type address at the start of a line, or after a space.
|
||||
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
|
||||
$ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
|
||||
|
||||
// Remove our padding..
|
||||
$ret = substr($ret, 1);
|
||||
|
||||
return($ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Nathan Codding - August 24, 2000.
|
||||
* Takes a string, and does the reverse of the PHP standard function
|
||||
@ -670,63 +612,4 @@ function replace_listitems($text, $uid)
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the "/" character with "\/". This is useful when you need
|
||||
* to stick a runtime string into a PREG regexp that is being delimited
|
||||
* with slashes.
|
||||
*/
|
||||
function escape_slashes($input)
|
||||
{
|
||||
$output = str_replace('/', '\/', $input);
|
||||
return $output;
|
||||
}
|
||||
|
||||
//
|
||||
// Smilies code ... would this be better tagged on to the end of bbcode.php?
|
||||
// Probably so and I'll move it before B2
|
||||
//
|
||||
function smilies_pass($message)
|
||||
{
|
||||
global $db, $config;
|
||||
static $smilies;
|
||||
|
||||
if ( empty($smilies) )
|
||||
{
|
||||
$sql = "SELECT code, smile_url
|
||||
FROM " . SMILIES_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ( !($smilies = $db->sql_fetchrowset($result)) )
|
||||
{
|
||||
return $message;
|
||||
}
|
||||
|
||||
usort($smilies, 'smiley_sort');
|
||||
}
|
||||
|
||||
for($i = 0; $i < count($smilies); $i++)
|
||||
{
|
||||
$orig[] = '/(?<=.\\W|\\W.|^\\W)' . preg_quote($smilies[$i]['code'], '/') . '(?=.\\W|\\W.|\\W$)/';
|
||||
$repl[] = '<img src="'. $config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" width="' . $smilies[$i]['smile_width'] . '" height="' . $smilies[$i]['smile_height'] . '" alt="' . $smilies[$i]['smile_url'] . '" title="' . $smilies[$i]['smile_url'] . '" border="0" />';
|
||||
}
|
||||
|
||||
if ( $i > 0 )
|
||||
{
|
||||
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
|
||||
$message = substr($message, 1, -1);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
function smiley_sort($a, $b)
|
||||
{
|
||||
if ( strlen($a['code']) == strlen($b['code']) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ( strlen($a['code']) > strlen($b['code']) ) ? - 1 : 1;
|
||||
}
|
||||
|
||||
?>
|
@ -191,7 +191,8 @@ $lang = array_merge($lang, array(
|
||||
|
||||
'POST_STICKY' => 'Sticky',
|
||||
'POST_ANNOUNCEMENT' => 'Announcement',
|
||||
'FORUM_LOCKED' => 'Forum is locked',
|
||||
'POST_FORUM_LOCKED' => 'Forum is locked',
|
||||
'POST_TOPIC_LOCKED' => 'Topic is locked',
|
||||
|
||||
|
||||
'Enter_password' => 'Please enter your username and password to login',
|
||||
@ -241,9 +242,10 @@ $lang = array_merge($lang, array(
|
||||
'ACP' => '[ %sAdministration Control Panel%s ]',
|
||||
'MCP' => '[ %sModerator Control Panel%s ]',
|
||||
|
||||
|
||||
'NO_TOPICS' => 'There are no posts in this forum<br />Click on the <b>Post New Topic</b> link on this page to post one',
|
||||
'NO_TOPIC' => 'The requested topic does not exist',
|
||||
'NO_MODE' => 'No mode specified.',
|
||||
'NO_TOPICS' => 'There are no posts in this forum<br />Click on the <b>Post New Topic</b> link on this page to post one.',
|
||||
'NO_TOPIC' => 'The requested topic does not exist.',
|
||||
'NO_POST' => 'The requested post does not exist.',
|
||||
|
||||
|
||||
'Stop_watching_forum' => 'Stop watching this forum',
|
||||
@ -262,7 +264,7 @@ $lang = array_merge($lang, array(
|
||||
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
||||
'POST_IGNORE' => 'This post was made by <b>%s</b> who is on your ignore list. To display this post click %sHERE%s.',
|
||||
'POST_BELOW_KARMA' => 'This post was made by <b>%1$s</b> whose karma rating of <b>%2$d</b> is below your desired minimum. To display this post click %3$sHERE%4$s.',
|
||||
'POST_ENCODING' => 'This post was made in a character set different to that being used here. Some text may display incorrectly. To view this post in its proper encoding click %sHERE%s.',
|
||||
'POST_ENCODING' => 'This post by <b>%1$s</b> was made in a character set different to yours. To view this post in its proper encoding click %2$sHERE%3$s.',
|
||||
'DISPLAY_POSTS' => 'Display posts from previous',
|
||||
'ALL_POSTS' => 'All Posts',
|
||||
|
||||
|
@ -73,7 +73,7 @@ switch ($mode)
|
||||
case 'post':
|
||||
if (empty($forum_id))
|
||||
{
|
||||
trigger_error($user->lang['No_forum_id']);
|
||||
trigger_error($user->lang['NO_FORUM']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT forum_id, forum_name, forum_parents, forum_status, forum_postable, enable_icons, enable_post_count, enable_moderate
|
||||
@ -84,7 +84,7 @@ switch ($mode)
|
||||
case 'reply':
|
||||
if (empty($topic_id))
|
||||
{
|
||||
trigger_error($user->lang['No_topic_id']);
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT t.*, f.forum_name, f.forum_parents, f.forum_status, f.forum_postable, f.enable_icons, f.enable_post_count, f.enable_moderate
|
||||
@ -98,21 +98,20 @@ switch ($mode)
|
||||
case 'delete':
|
||||
if (empty($post_id))
|
||||
{
|
||||
trigger_error($user->lang['No_post_id']);
|
||||
trigger_error($user->lang['NO_POST']);
|
||||
}
|
||||
|
||||
$sql = 'SELECT t.*, p.*, pt.*, f.forum_name, f.forum_parents, f.forum_status, f.forum_postable, f.enable_icons, f.enable_post_count, f.enable_moderate
|
||||
FROM ' . POSTS_TABLE . ' p, ' . POSTS_TEXT_TABLE . ' pt, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
|
||||
$sql = 'SELECT t.*, p.*, f.forum_name, f.forum_parents, f.forum_status, f.forum_postable, f.enable_icons, f.enable_post_count, f.enable_moderate
|
||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
|
||||
WHERE p.post_id = ' . $post_id . '
|
||||
AND t.topic_id = p.topic_id
|
||||
AND pt.post_id = p.post_id
|
||||
AND f.forum_id = t.forum_id';
|
||||
break;
|
||||
|
||||
case 'topicreview':
|
||||
if (!isset($topic_id))
|
||||
{
|
||||
trigger_error($user->lang['Topic_not_exist']);
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
topic_review($topic_id, false);
|
||||
@ -123,7 +122,7 @@ switch ($mode)
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error($user->lang['No_valid_mode']);
|
||||
trigger_error($user->lang['NO_MODE']);
|
||||
}
|
||||
|
||||
if ($sql != '')
|
||||
@ -172,20 +171,20 @@ if ($mode == 'edit' && !empty($poll_start))
|
||||
|
||||
if (!$auth->acl_gets('f_' . $mode, 'm_', 'a_', intval($forum_id)) && !empty($forum_postable))
|
||||
{
|
||||
trigger_error($user->lang['User_cannot_' . $mode]);
|
||||
trigger_error($user->lang['USER_CANNOT_' . strtoupper($mode)]);
|
||||
}
|
||||
|
||||
// Forum/Topic locked?
|
||||
if ((intval($forum_status) == ITEM_LOCKED || intval($topic_status) == ITEM_LOCKED) && !$auth->acl_gets('m_edit', 'a_', intval($forum_id)))
|
||||
{
|
||||
$message = (intval($forum_status) == ITEM_LOCKED) ? 'Forum_locked' : 'Topic_locked';
|
||||
$message = (intval($forum_status) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED';
|
||||
trigger_error($user->lang[$message]);
|
||||
}
|
||||
|
||||
// Can we edit this post?
|
||||
if (($mode == 'edit' || $mode == 'delete') && !empty($config['edit_time']) && $post_time < time() - intval($config['edit_time']) && !$auth->acl_gets('m_edit', 'a_', intval($forum_id)))
|
||||
{
|
||||
trigger_error($user->lang['Cannot_edit_time']);
|
||||
trigger_error($user->lang['CANNOT_EDIT_TIME']);
|
||||
}
|
||||
|
||||
// PERMISSION CHECKS
|
||||
@ -330,17 +329,18 @@ if (isset($_REQUEST['post']))
|
||||
{
|
||||
$db->sql_transaction();
|
||||
|
||||
// topic info
|
||||
// Initial Topic table info
|
||||
if ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id))
|
||||
{
|
||||
$topic_sql = array(
|
||||
'forum_id' => intval($forum_id),
|
||||
'topic_title' => stripslashes($subject),
|
||||
'topic_poster' => intval($user->data['user_id']),
|
||||
'topic_time' => $current_time,
|
||||
'topic_type' => $topic_type,
|
||||
'topic_time' => $current_time,
|
||||
'topic_type' => $topic_type,
|
||||
'topic_approved'=> (!empty($enable_moderate) && !$auth->acl_gets('f_ignorequeue', 'm_', 'a_', intval($forum_id))) ? 0 : 1,
|
||||
'icon_id' => $icon_id,
|
||||
'topic_approved'=> (!empty($enable_moderate) && !$auth->acl_gets('f_ignorequeue', 'm_', 'a_', intval($forum_id))) ? 0 : 1,
|
||||
'topic_poster' => intval($user->data['user_id']),
|
||||
'topic_first_poster_name' => ($username != '') ? stripslashes($username) : (($user->data['user_id'] == ANONYMOUS) ? '' : stripslashes($user->data['username'])),
|
||||
);
|
||||
if (!empty($poll_options))
|
||||
{
|
||||
@ -356,12 +356,13 @@ if (isset($_REQUEST['post']))
|
||||
$topic_id = ($mode == 'post') ? $db->sql_nextid() : $topic_id;
|
||||
}
|
||||
|
||||
// post
|
||||
// Post table info
|
||||
$post_sql = array(
|
||||
'topic_id' => intval($topic_id),
|
||||
'forum_id' => intval($forum_id),
|
||||
'poster_id' => ($mode == 'edit') ? intval($poster_id) : intval($user->data['user_id']),
|
||||
'post_username' => ($username != '') ? stripslashes($username) : '',
|
||||
'post_subject' => stripslashes($subject),
|
||||
'icon_id' => $icon_id,
|
||||
'poster_ip' => $user->ip,
|
||||
'post_time' => $current_time,
|
||||
@ -372,28 +373,21 @@ if (isset($_REQUEST['post']))
|
||||
'enable_html' => $enable_html,
|
||||
'enable_smilies' => $enable_smilies,
|
||||
'enable_magic_url' => $enable_urls,
|
||||
'bbcode_uid' => $bbcode_uid,
|
||||
);
|
||||
if ($mode != 'edit' || $message_md5 != $post_checksum)
|
||||
{
|
||||
$post_sql = array_merge($post_sql, array(
|
||||
'post_checksum' => $message_md5,
|
||||
'post_text' => stripslashes($message),
|
||||
'post_encoding' => $user->lang['ENCODING']
|
||||
));
|
||||
}
|
||||
$sql = ($mode == 'edit' && $poster_id == $user->data['user_id']) ? 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_sql) . ' , post_edit_count = post_edit_count + 1 WHERE post_id = ' . intval($post_id) : 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $post_sql);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$post_id = ($mode == 'edit') ? $post_id : $db->sql_nextid();
|
||||
|
||||
// post_text ... may merge into posts table
|
||||
$post_text_sql = array(
|
||||
'post_subject' => stripslashes($subject),
|
||||
'bbcode_uid' => $bbcode_uid,
|
||||
'post_id' => intval($post_id),
|
||||
);
|
||||
if ($mode != 'edit' || $message_md5 != $post_checksum)
|
||||
{
|
||||
$post_text_sql = array_merge($post_text_sql, array(
|
||||
'post_checksum' => $message_md5,
|
||||
'post_text' => stripslashes($message),
|
||||
));
|
||||
}
|
||||
$sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TEXT_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_text_sql) . ' WHERE post_id = ' . intval($post_id) : 'INSERT INTO ' . POSTS_TEXT_TABLE . ' ' . $db->sql_build_array('INSERT', $post_text_sql);
|
||||
$db->sql_query($sql);
|
||||
|
||||
// poll options
|
||||
if (!empty($poll_options))
|
||||
{
|
||||
@ -465,15 +459,12 @@ if (isset($_REQUEST['post']))
|
||||
'topic_last_post_id' => intval($post_id),
|
||||
'topic_last_post_time' => $current_time,
|
||||
'topic_last_poster_id' => intval($user->data['user_id']),
|
||||
'topic_last_poster_name'=> ($username != '') ? stripslashes($username) : '',
|
||||
'topic_last_poster_name'=> ($username != '') ? stripslashes($username) : (($user->data['user_id'] == ANONYMOUS) ? '' : stripslashes($user->data['username'])),
|
||||
);
|
||||
if ($mode == 'post')
|
||||
{
|
||||
$topic_sql = array_merge($topic_sql, array(
|
||||
'topic_first_post_id' => intval($post_id),
|
||||
'topic_time' => $current_time,
|
||||
'topic_poster' => intval($user->data['user_id']),
|
||||
'topic_first_poster_name' => ($username != '') ? stripslashes($username) : '',
|
||||
));
|
||||
}
|
||||
$topic_replies_sql = ($mode == 'reply') ? ', topic_replies = topic_replies + 1' : '';
|
||||
@ -543,7 +534,7 @@ if (isset($_REQUEST['post']))
|
||||
|
||||
|
||||
// -----------
|
||||
// DECODE TEXT
|
||||
// DECODE TEXT -> This will/should be handled by bbcode.php eventually
|
||||
|
||||
$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
|
||||
$server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
|
||||
@ -677,22 +668,8 @@ switch ($mode)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Nav links for forum ... same as viewforum, viewtopic ... should merge ...
|
||||
$forum_parents = unserialize($forum_parents);
|
||||
|
||||
foreach ($forum_parents as $parent_forum_id => $parent_name)
|
||||
{
|
||||
$template->assign_block_vars('navlinks', array(
|
||||
'FORUM_NAME' => $parent_name,
|
||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $parent_forum_id)
|
||||
);
|
||||
}
|
||||
$template->assign_block_vars('navlinks', array(
|
||||
'FORUM_NAME' => $forum_name,
|
||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id)
|
||||
);
|
||||
|
||||
// Build navigation links
|
||||
generate_forum_nav($forum_data);
|
||||
|
||||
|
||||
// Start assigning vars for main posting page ...
|
||||
@ -711,7 +688,6 @@ $template->assign_vars(array(
|
||||
'MODERATORS' => (sizeof($moderators)) ? implode(', ', $moderators[$forum_id]) : $user->lang['NONE'],
|
||||
|
||||
'L_POST_A' => $page_title,
|
||||
'L_SUBJECT' => $user->lang['Subject'],
|
||||
'L_MESSAGE_BODY_EXPLAIN'=> (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '',
|
||||
'L_ICON' => ($mode == 'reply' || $mode == 'quote') ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
|
||||
|
||||
@ -767,9 +743,11 @@ if ($auth->acl_gets('f_attach', 'm_edit', 'a_', $forum_id))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Output page ...
|
||||
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'posting_body.html')
|
||||
);
|
||||
@ -787,15 +765,14 @@ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||
// FUNCTIONS
|
||||
function topic_review($topic_id, $is_inline_review = false)
|
||||
{
|
||||
global $SID, $db, $config, $template, $user, $auth;
|
||||
global $orig_word, $replacement_word;
|
||||
global $phpEx, $phpbb_root_path, $starttime;
|
||||
global $SID, $db, $config, $template, $user, $auth, $phpEx, $phpbb_root_path, $starttime;
|
||||
global $censors;
|
||||
|
||||
// Define censored word matches
|
||||
if (empty($orig_word) && empty($replacement_word))
|
||||
if (empty($censors))
|
||||
{
|
||||
$orig_word = $replacement_word = array();
|
||||
obtain_word_list($orig_word, $replacement_word);
|
||||
$censors = array();
|
||||
obtain_word_list($censors);
|
||||
}
|
||||
|
||||
if (!$is_inline_review)
|
||||
@ -809,7 +786,7 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
trigger_error($user->lang['Topic_post_not_exist']);
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
$forum_id = intval($row['forum_id']);
|
||||
@ -817,12 +794,12 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||
|
||||
if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
|
||||
{
|
||||
trigger_error($user->lang['Sorry_auth_read']);
|
||||
trigger_error($user->lang['SORRY_AUTH_READ']);
|
||||
}
|
||||
|
||||
if (count($orig_word))
|
||||
{
|
||||
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
|
||||
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -833,11 +810,10 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||
}
|
||||
|
||||
// Go ahead and pull all data for this topic
|
||||
$sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
|
||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
|
||||
$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
|
||||
AND p.post_id = pt.post_id
|
||||
ORDER BY p.post_time DESC
|
||||
LIMIT " . $config['posts_per_page'];
|
||||
$result = $db->sql_query($sql);
|
||||
@ -870,12 +846,12 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||
|
||||
if (count($orig_word))
|
||||
{
|
||||
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
|
||||
$message = preg_replace($orig_word, $replacement_word, $message);
|
||||
$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']),
|
||||
'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,
|
||||
@ -888,7 +864,7 @@ function topic_review($topic_id, $is_inline_review = false)
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['Topic_post_not_exist']);
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Define the bbCode tags
|
||||
bbcode = new Array();
|
||||
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
|
||||
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[flash]','[/flash]','[url]','[/url]');
|
||||
imageTag = false;
|
||||
|
||||
// Helpline messages
|
||||
@ -106,10 +106,11 @@ function checkForm()
|
||||
<td><input type="button" class="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" /></td>
|
||||
<td><input type="button" class="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" /></td>
|
||||
<td><input type="button" class="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" /></td>
|
||||
<td><input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" onmouseover="helpline('w')" /></td>
|
||||
<td><input type="button" class="button" accesskey="f" name="addbbcode16" value="Flash" style="width: 40px" onclick="bbstyle(16)" onmouseover="helpline('p')" /></td>
|
||||
<td><input type="button" class="button" accesskey="w" name="addbbcode18" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(18)" onmouseover="helpline('w')" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<td colspan="10"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td><span class="genmed"> {L_FONT_SIZE}:</span> <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" onmouseover="helpline('f')">
|
||||
<option value="7">{L_FONT_TINY}</option>
|
||||
@ -123,11 +124,11 @@ function checkForm()
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" width="450"><input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" /></td>
|
||||
<td colspan="10" width="450"><input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" /></td>
|
||||
<td align="center"><span class="genmed">{L_FONT_COLOR}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9"><textarea style="width:450px" name="message" rows="15" cols="35" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td>
|
||||
<td colspan="10"><textarea style="width:450px" name="message" rows="15" cols="35" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td>
|
||||
<td width="100%" align="center" valign="top"><table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td bgcolor="black"><script language="javascript" type="text/javascript"><!--
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!-- IF S_DISPLAY_INLINE -->
|
||||
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
|
||||
<tr>
|
||||
<td class="catHead" height="28" align="center"><b><span class="cattitle">{L_TOPIC_REVIEW}</span></b></td>
|
||||
<td class="cat" height="28" align="center"><b><span class="cattitle">{L_TOPIC_REVIEW}</span></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><iframe width="100%" height="300" src="{U_REVIEW_TOPIC}">
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
<!-- ENDIF -->
|
||||
|
||||
<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
|
||||
<table class="tablebg" width="100%" cellpadding="2" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<th class="thCornerL" width="22%" height="26">{L_AUTHOR}</th>
|
||||
<th class="thCornerR">{L_MESSAGE}</th>
|
||||
<th width="22%" height="26">{L_AUTHOR}</th>
|
||||
<th>{L_MESSAGE}</th>
|
||||
</tr>
|
||||
<!-- BEGIN postrow -->
|
||||
<!-- IF postrow.S_ROW_COUNT is even -->
|
||||
@ -38,7 +38,7 @@
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" height="1" class="spaceRow"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
|
||||
<td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
|
||||
</tr>
|
||||
<!-- END postrow -->
|
||||
</table>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<div align="center"><span class="copyright"><br />
|
||||
<br clear="all" /><div class="copyright" align="center">
|
||||
<!--
|
||||
We request you retain the full copyright notice below including the link to www.phpbb.com.
|
||||
This not only gives respect to the large amount of time given freely by the developers
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
The phpBB Group : 2002
|
||||
// -->
|
||||
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} © 2002 phpBB Group</span></div>
|
||||
Powered by <a href="http://www.phpbb.com/" target="_phpbb">phpBB</a> {PHPBB_VERSION} © 2002 phpBB Group</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -12,11 +12,12 @@
|
||||
<!--
|
||||
{T_STYLESHEET_DATA}
|
||||
|
||||
body {margin:0px;padding:0px;border:0px}
|
||||
body {background: white;}
|
||||
//-->
|
||||
</style>
|
||||
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
|
||||
<span class="gen"><a name="top"></a></span>
|
||||
<body>
|
||||
|
||||
<a name="top"></a>
|
||||
|
@ -86,20 +86,16 @@
|
||||
<th nowrap="nowrap">{L_MESSAGE}</th>
|
||||
</tr>
|
||||
<!-- BEGIN postrow -->
|
||||
<!-- IF postrow.S_ROW_COUNT is even -->
|
||||
<tr class="row1">
|
||||
<!-- ELSE -->
|
||||
<tr class="row2">
|
||||
<!-- ENDIF -->
|
||||
<!-- IF postrow.S_BELOW_MIN_KARMA -->
|
||||
<!-- IF postrow.S_ROW_COUNT is even -->
|
||||
<tr class="row1">
|
||||
<!-- ELSE -->
|
||||
<tr class="row2">
|
||||
<!-- ENDIF -->
|
||||
<td colspan="2" height="25" align="center"><span class="gensmall">{postrow.L_IGNORE_POST}</span></td>
|
||||
</tr>
|
||||
<!-- ELSEIF postrow.S_WRONG_ENCODING -->
|
||||
<td colspan="2" height="25" align="center"><span class="gensmall">{postrow.L_IGNORE_POST}</span></td>
|
||||
<!-- ELSE -->
|
||||
<!-- IF postrow.S_ROW_COUNT is even -->
|
||||
<tr class="row1">
|
||||
<!-- ELSE -->
|
||||
<tr class="row2">
|
||||
<!-- ENDIF -->
|
||||
<td width="150" align="left" valign="top"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
|
||||
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
@ -133,8 +129,8 @@
|
||||
<td width="100%" align="right" nowrap="nowrap"><!-- span class="gensmall">{postrow.RATING}</span --> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
|
||||
</tr>
|
||||
|
@ -237,7 +237,7 @@ if ($forum_data['forum_postable'])
|
||||
'FOLDER_ANNOUNCE_IMG' => $user->img('folder_announce', 'POST_ANNOUNCEMENT'),
|
||||
'FOLDER_ANNOUNCE_NEW_IMG'=> $user->img('folder_announce_new', 'POST_ANNOUNCEMENT'),
|
||||
|
||||
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
|
||||
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
|
||||
|
||||
'S_IS_POSTABLE' => TRUE,
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
@ -386,8 +386,7 @@ if ($forum_data['forum_postable'])
|
||||
$unread_topic = true;
|
||||
if ($user->data['user_id'] != ANONYMOUS &&
|
||||
($row['topic_last_post_time'] <= $row['lastread_time'] ||
|
||||
$row['topic_last_post_time'] < (time() - $config['lastread']) ||
|
||||
$row['topic_last_post_time'] < $forum_row['lastread_time'])
|
||||
$row['topic_last_post_time'] < (time() - $config['lastread']))
|
||||
)
|
||||
{
|
||||
$unread_topic = false;
|
||||
|
@ -25,20 +25,26 @@ include($phpbb_root_path . 'extension.inc');
|
||||
include($phpbb_root_path . 'common.'.$phpEx);
|
||||
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||
|
||||
// Start initial var setup
|
||||
|
||||
// Initial var setup
|
||||
$topic_id = (isset($_GET['t'])) ? intval($_GET['t']) : 0;
|
||||
$post_id = (isset($_GET['p'])) ? intval($_GET['p']) : 0;
|
||||
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
|
||||
|
||||
$sort_days = (!empty($_REQUEST['sort_days'])) ? intval($_REQUEST['sort_days']) : 0;
|
||||
$sort_key = (!empty($_REQUEST['sort_key'])) ? $_REQUEST['sort_key'] : 't';
|
||||
$sort_dir = (!empty($_REQUEST['sort_dir'])) ? $_REQUEST['sort_dir'] : 'a';
|
||||
|
||||
|
||||
// Do we have a topic or post id?
|
||||
if (empty($topic_id) && empty($post_id))
|
||||
{
|
||||
trigger_error('Topic_post_not_exist');
|
||||
trigger_error('NO_TOPIC');
|
||||
}
|
||||
|
||||
|
||||
// Start session management
|
||||
$user->start();
|
||||
// End session management
|
||||
|
||||
|
||||
|
||||
// Find topic id if user requested a newer or older topic
|
||||
@ -51,9 +57,9 @@ if (isset($_GET['view']) && empty($post_id))
|
||||
$sql = "SELECT p.post_id
|
||||
FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
|
||||
WHERE s.session_id = '$user->session_id'
|
||||
AND u.user_id = s.session_user_id
|
||||
AND p.topic_id = $topic_id
|
||||
AND p.post_approved = 1
|
||||
AND u.user_id = s.session_user_id
|
||||
AND p.topic_id = $topic_id
|
||||
AND p.post_approved = 1
|
||||
AND p.post_time >= u.user_lastvisit
|
||||
ORDER BY p.post_time ASC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
@ -63,9 +69,7 @@ if (isset($_GET['view']) && empty($post_id))
|
||||
trigger_error('No_new_posts_last_visit');
|
||||
}
|
||||
|
||||
$post_id = $row['post_id'];
|
||||
$newest_post_id = $post_id;
|
||||
//redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
|
||||
redirect("viewtopic.$phpEx$SID&p=" . $row['post_id'] . "#" . $row['post_id']);
|
||||
}
|
||||
|
||||
redirect("index.$phpEx");
|
||||
@ -85,7 +89,7 @@ if (isset($_GET['view']) && empty($post_id))
|
||||
|
||||
if (!($row = $db->sql_fetchrow($result)))
|
||||
{
|
||||
$message = ($_GET['view'] == 'next') ? 'No_newer_topics' : 'No_older_topics';
|
||||
$message = ($_GET['view'] == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS';
|
||||
trigger_error($message);
|
||||
}
|
||||
else
|
||||
@ -96,7 +100,6 @@ if (isset($_GET['view']) && empty($post_id))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Look at this query ... perhaps a re-think? Perhaps store topic ids rather
|
||||
// than last/first post ids and have a redirect at the top of this page
|
||||
// for latest post, newest post for a given topic_id?
|
||||
@ -119,7 +122,8 @@ if ($user->data['user_id'] != ANONYMOUS)
|
||||
|
||||
default:
|
||||
$extra_fields .= ', tw.notify_status';
|
||||
$join_sql_table .= ' LEFT JOIN ' . TOPICS_WATCH_TABLE . ' tw ON tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id';
|
||||
$join_sql_table .= ' LEFT JOIN ' . TOPICS_WATCH_TABLE . ' tw ON tw.user_id = ' . $user->data['user_id'] . '
|
||||
AND t.topic_id = tw.topic_id';
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,16 +136,15 @@ $result = $db->sql_query($sql);
|
||||
|
||||
if (!$topic_data = $db->sql_fetchrow($result))
|
||||
{
|
||||
trigger_error('Topic_post_not_exist');
|
||||
trigger_error('NO_TOPIC');
|
||||
}
|
||||
extract($topic_data);
|
||||
|
||||
|
||||
|
||||
// Configure style, language, etc.
|
||||
$user->setup(false, intval($forum_style));
|
||||
$auth->acl($user->data, intval($forum_id));
|
||||
// End configure
|
||||
|
||||
|
||||
// Start auth check
|
||||
if (!$auth->acl_gets('f_read', 'm_', 'a_', intval($forum_id)))
|
||||
@ -155,33 +158,35 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', intval($forum_id)))
|
||||
|
||||
trigger_error($user->lang['Sorry_auth_read']);
|
||||
}
|
||||
// End auth check
|
||||
|
||||
|
||||
|
||||
|
||||
// What is start equal to?
|
||||
if (!empty($post_id))
|
||||
{
|
||||
$start = floor(($prev_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
|
||||
}
|
||||
|
||||
|
||||
// Are we watching this topic?
|
||||
$s_watching_topic = '';
|
||||
$s_watching_topic_img = '';
|
||||
watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id, $notify_status);
|
||||
|
||||
|
||||
|
||||
|
||||
// Post ordering options
|
||||
$previous_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
||||
$sort_by = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'pt.post_subject');
|
||||
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
|
||||
|
||||
if (isset($_POST['sort']))
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
||||
$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'pt.post_subject');
|
||||
|
||||
gen_sort_selects($limit_days, $sort_by_text, $s_limit_days, $s_sort_key, $s_sort_dir);
|
||||
|
||||
|
||||
// Limit posts to certain time frame, obtain correct post count
|
||||
if (isset($_REQUEST['sort']))
|
||||
{
|
||||
if (!empty($_POST['sort_days']))
|
||||
if ($sort_days)
|
||||
{
|
||||
$sort_days = (!empty($_POST['sort_days'])) ? intval($_POST['sort_days']) : intval($_GET['sort_days']);
|
||||
$min_post_time = time() - ($sort_days * 86400);
|
||||
|
||||
$sql = "SELECT COUNT(post_id) AS num_posts
|
||||
@ -199,55 +204,21 @@ if (isset($_POST['sort']))
|
||||
{
|
||||
$topic_replies++;
|
||||
}
|
||||
|
||||
$sort_key = (isset($_POST['sort_key'])) ? $_POST['sort_key'] : $_GET['sort_key'];
|
||||
$sort_dir = (isset($_POST['sort_dir'])) ? $_POST['sort_dir'] : $_GET['sort_dir'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic_replies++;
|
||||
$limit_posts_time = '';
|
||||
|
||||
$sort_days = 0;
|
||||
$sort_key = 't';
|
||||
$sort_dir = 'a';
|
||||
}
|
||||
|
||||
$sort_order = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||
|
||||
$select_sort_days = '<select name="sort_days">';
|
||||
foreach ($previous_days as $day => $text)
|
||||
{
|
||||
$selected = ($sort_days == $day) ? ' selected="selected"' : '';
|
||||
$select_sort_days .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
|
||||
}
|
||||
$select_sort_days .= '</select>';
|
||||
|
||||
$select_sort = '<select name="sort_key">';
|
||||
foreach ($sort_by_text as $key => $text)
|
||||
{
|
||||
$selected = ($sort_key == $key) ? ' selected="selected"' : '';
|
||||
$select_sort .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
|
||||
}
|
||||
$select_sort .= '</select>';
|
||||
|
||||
$select_sort_dir = '<select name="sort_dir">';
|
||||
$select_sort_dir .= ($sort_dir == 'a') ? '<option value="a" selected="selected">' . $user->lang['ASCENDING'] . '</option><option value="d">' . $user->lang['DESCENDING'] . '</option>' : '<option value="a">' . $user->lang['ASCENDING'] . '</option><option value="d" selected="selected">' . $user->lang['DESCENDING'] . '</option>';
|
||||
$select_sort_dir .= '</select>';
|
||||
|
||||
$select_post_days = '<select name="postdays">';
|
||||
for($i = 0; $i < count($previous_days); $i++)
|
||||
{
|
||||
$selected = ($post_days == $previous_days[$i]) ? ' selected="selected"' : '';
|
||||
$select_post_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
|
||||
}
|
||||
$select_post_days .= '</select>';
|
||||
|
||||
// Select the sort order
|
||||
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
||||
|
||||
|
||||
// Cache this? ... it is after all doing a simple data grab
|
||||
$sql = "SELECT *
|
||||
FROM " . RANKS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$result = $db->sql_query($sql, 120);
|
||||
|
||||
$ranksrow = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@ -263,7 +234,6 @@ $icons = array();
|
||||
obtain_icons($icons);
|
||||
|
||||
|
||||
|
||||
// Was a highlight request part of the URI?
|
||||
$highlight_match = $highlight = '';
|
||||
if (isset($_GET['highlight']))
|
||||
@ -284,11 +254,12 @@ if (isset($_GET['highlight']))
|
||||
}
|
||||
|
||||
|
||||
// Forum rules listing
|
||||
$s_forum_rules = '';
|
||||
gen_forum_rules('topic', $forum_id);
|
||||
|
||||
|
||||
// Quick mod tools
|
||||
$s_forum_rules = '';
|
||||
get_forum_rules('topic', $s_forum_rules, $forum_id);
|
||||
|
||||
$topic_mod = '';
|
||||
$topic_mod .= ($auth->acl_gets('m_lock', 'a_', $forum_id)) ? ((intval($topic_status) == ITEM_UNLOCKED) ? '<option value="lock">' . $user->lang['LOCK_TOPIC'] . '</option>' : '<option value="unlock">' . $user->lang['UNLOCK_TOPIC'] . '</option>') : '';
|
||||
$topic_mod .= ($auth->acl_gets('m_delete', 'a_', $forum_id)) ? '<option value="delete">' . $user->lang['DELETE_TOPIC'] . '</option>' : '';
|
||||
@ -296,32 +267,32 @@ $topic_mod .= ($auth->acl_gets('m_move', 'a_', $forum_id)) ? '<option value="mov
|
||||
$topic_mod .= ($auth->acl_gets('m_split', 'a_', $forum_id)) ? '<option value="split">' . $user->lang['SPLIT_TOPIC'] . '</option>' : '';
|
||||
$topic_mod .= ($auth->acl_gets('m_merge', 'a_', $forum_id)) ? '<option value="merge">' . $user->lang['MERGE_TOPIC'] . '</option>' : '';
|
||||
|
||||
|
||||
// If we've got a hightlight set pass it on to pagination.
|
||||
$pagination = ($highlight_match) ? generate_pagination("viewtopic.$phpEx$SID&t=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $topic_replies, $config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx$SID&t=$topic_id&postdays=$post_days&postorder=$post_order", $topic_replies, $config['posts_per_page'], $start);
|
||||
|
||||
// Post, reply and other URL generation for
|
||||
// templating vars
|
||||
|
||||
// Post, reply and other URL generation for templating vars
|
||||
$new_topic_url = 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id;
|
||||
$reply_topic_url = 'posting.' . $phpEx . $SID . '&mode=reply&f=' . $forum_id . '&t=' . $topic_id;
|
||||
$view_forum_url = 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id;
|
||||
$view_prev_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=previous';
|
||||
$view_next_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=next';
|
||||
|
||||
$reply_img = ($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) ? $user->img('reply_locked', $user->lang['Topic_locked']) : $user->img('reply_new', $user->lang['Reply_to_topic']);
|
||||
$post_img = ($forum_status == ITEM_LOCKED) ? $user->img('post_locked', $user->lang['Forum_locked']) : $user->img('post_new', $user->lang['Post_new_topic']);
|
||||
|
||||
// Post/reply images
|
||||
$reply_img = ($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) ? $user->img('reply_locked', $user->lang['TOPIC_LOCKED']) : $user->img('reply_new', $user->lang['REPLY_TO_TOPIC']);
|
||||
$post_img = ($forum_status == ITEM_LOCKED) ? $user->img('post_locked', $user->lang['FORUM_LOCKED']) : $user->img('post_new', $user->lang['POST_NEW_TOPIC']);
|
||||
|
||||
|
||||
// Set a cookie for this topic
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
/*if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$mark_topics = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_t'])) : array();
|
||||
|
||||
$mark_topics[$forum_id][$topic_id] = 0;
|
||||
setcookie($config['cookie_name'] . '_t', serialize($mark_topics), 0, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
// Grab censored words
|
||||
@ -344,10 +315,8 @@ $forum_moderators = array();
|
||||
get_moderators($forum_moderators, $forum_id);
|
||||
|
||||
|
||||
|
||||
// This is only used for print view so ...
|
||||
$server_path = (($config['cookie_secure']) ? 'https://' : 'http://' ) . trim($config['server_name']) . (($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/') . trim($config['script_path']) . '/';
|
||||
|
||||
$server_path = (($config['cookie_secure']) ? 'https://' : 'http://') . trim($config['server_name']) . (($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/') . trim($config['script_path']) . '/';
|
||||
|
||||
|
||||
// Send vars to template
|
||||
@ -366,13 +335,11 @@ $template->assign_vars(array(
|
||||
'REPLY_IMG' => $reply_img,
|
||||
|
||||
'S_TOPIC_LINK' => 't',
|
||||
'S_SELECT_SORT_DIR' => $select_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $select_sort,
|
||||
'S_SELECT_SORT_DAYS' => $select_sort_days,
|
||||
'S_SELECT_RATING' => $rating,
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
'S_TOPIC_ACTION' => "viewtopic.$phpEx$SID&t=" . $topic_id . "&start=$start",
|
||||
'S_AUTH_LIST' => $s_forum_rules,
|
||||
'S_TOPIC_MOD' => ( $topic_mod != '' ) ? '<select name="mode">' . $topic_mod . '</select>' : '',
|
||||
'S_TOPIC_MOD' => ($topic_mod != '') ? '<select name="mode">' . $topic_mod . '</select>' : '',
|
||||
'S_MOD_ACTION' => "mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&quickmod=1",
|
||||
'S_WATCH_TOPIC' => $s_watching_topic,
|
||||
|
||||
@ -389,25 +356,6 @@ $template->assign_vars(array(
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Mozilla navigation bar
|
||||
$nav_links['prev'] = array(
|
||||
'url' => $view_prev_topic_url,
|
||||
'title' => $user->lang['View_previous_topic']
|
||||
);
|
||||
$nav_links['next'] = array(
|
||||
'url' => $view_next_topic_url,
|
||||
'title' => $user->lang['View_next_topic']
|
||||
);
|
||||
$nav_links['up'] = array(
|
||||
'url' => $view_forum_url,
|
||||
'title' => $forum_name
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Does this topic contain a poll?
|
||||
if (!empty($poll_start))
|
||||
{
|
||||
@ -476,64 +424,78 @@ if (!empty($poll_start))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TEMP TEMP TEMP TEMP
|
||||
$rating = '';
|
||||
for ($i = 0; $i < 6; $i++)
|
||||
{
|
||||
$rating .= (($rating != '') ? ' ' : '') . '<a href="viewtopic.' . $phpEx . $SID . '&p=??&rate=' . $i . '">' . $i . '</a>';
|
||||
}
|
||||
// TEMP TEMP TEMP TEMP
|
||||
|
||||
|
||||
|
||||
// Container for user details, only process once
|
||||
$user_cache = $attach_list = array();
|
||||
$force_encoding = '';
|
||||
$i = 0;
|
||||
|
||||
// Go ahead and pull all data for this topic
|
||||
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_karma, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, u.user_avatar_type, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
|
||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
|
||||
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_karma, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, u.user_avatar_type, p.*
|
||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
||||
WHERE p.topic_id = $topic_id
|
||||
AND p.post_approved = " . TRUE . "
|
||||
AND pt.post_id = p.post_id
|
||||
$limit_posts_time
|
||||
AND u.user_id = p.poster_id
|
||||
ORDER BY $sort_order";
|
||||
$result = $db->sql_query_limit($sql, $start, $config['posts_per_page']);
|
||||
$result = $db->sql_query_limit($sql, intval($start), intval($config['posts_per_page']));
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
do
|
||||
{
|
||||
$poster_id = $row['user_id'];
|
||||
$poster = (!$poster_id) ? $user->lang['GUEST'] : $row['username'];
|
||||
$poster = ($poster_id == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'];
|
||||
|
||||
// Should we display this post? At present this is just karma but
|
||||
// it will also check the ignore list in future ... outputting the
|
||||
// appropriate message of course.
|
||||
|
||||
// Three situations can prevent a post being display:
|
||||
// i) The posters karma is below the minimum of the user
|
||||
// ii) The poster is on the users ignore list
|
||||
// iii) The post was made in a codepage different from the users
|
||||
if ($row['user_karma'] < $user->data['user_min_karma'] && (empty($_GET['view']) || $_GET['view'] != 'karma' || $post_id != $row['post_id']))
|
||||
{
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'S_BELOW_MIN_KARMA' => true,
|
||||
'S_ROW_COUNT' => $i++,
|
||||
|
||||
'L_IGNORE_POST' => sprintf($user->lang['POST_BELOW_KARMA'], $poster, '<a href="viewtopic.' . $phpEx . $SID . '&p=' . $row['post_id'] . '&view=karma#' . $row['post_id'] . '">', '</a>'))
|
||||
'L_IGNORE_POST' => sprintf($user->lang['POST_BELOW_KARMA'], $poster, intval($row['user_karma']), '<a href="viewtopic.' . $phpEx . $SID . '&p=' . $row['post_id'] . '&view=karma#' . $row['post_id'] . '">', '</a>'))
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
else if ($row['post_encoding'] != $user->lang['ENCODING'])
|
||||
{
|
||||
if (!empty($_GET['view']) && $_GET['view'] == 'encoding' && $post_id == $row['post_id'])
|
||||
{
|
||||
$force_encoding = $row['post_encoding'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('postrow', array(
|
||||
'S_WRONG_ENCODING' => true,
|
||||
'S_ROW_COUNT' => $i++,
|
||||
|
||||
// Display the post
|
||||
$poster_posts = ($row['user_id']) ? $user->lang['POSTS'] . ': ' . $row['user_posts'] : '';
|
||||
'L_IGNORE_POST' => sprintf($user->lang['POST_ENCODING'], $poster, '<a href="viewtopic.' . $phpEx . $SID . '&p=' . $row['post_id'] . '&view=encoding#' . $row['post_id'] . '">', '</a>'))
|
||||
);
|
||||
|
||||
$poster_from = ($row['user_from'] && $row['user_id']) ? $user->lang['LOCATION'] . ': ' . $row['user_from'] : '';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($user_cache[$poster_id]['joined']))
|
||||
|
||||
// Display the post - Cache this
|
||||
$poster_posts = ($row['user_id'] != ANONYMOUS) ? $user->lang['POSTS'] . ': ' . $row['user_posts'] : '';
|
||||
|
||||
|
||||
// Cache this
|
||||
$poster_from = ($row['user_from'] && $row['user_id'] != ANONYMOUS) ? $user->lang['LOCATION'] . ': ' . $row['user_from'] : '';
|
||||
|
||||
|
||||
if (!isset($user_cache[$poster_id]['joined']) && $poster_id != ANONYMOUS)
|
||||
{
|
||||
$user_cache[$poster_id]['joined'] = ($row['user_id']) ? $user->lang['JOINED'] . ': ' . $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']) : '';
|
||||
}
|
||||
|
||||
|
||||
if (isset($user_cache[$poster_id]['avatar']))
|
||||
{
|
||||
if ($row['user_avatar_type'] && $poster_id && $row['user_allowavatar'])
|
||||
@ -558,7 +520,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generate ranks, set them to empty string initially.
|
||||
if (!isset($user_cache[$poster_id]['rank_title']))
|
||||
{
|
||||
@ -587,23 +548,24 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle anon users posting with usernames
|
||||
if (!$poster_id && $row['post_username'] != '')
|
||||
if ($poster_id == ANONYMOUS && $row['post_username'] != '')
|
||||
{
|
||||
$poster = $row['post_username'];
|
||||
$poster_rank = $user->lang['GUEST'];
|
||||
$user_cache[$poster_id]['rank_title'] = $user->lang['GUEST'];
|
||||
$user_cache[$poster_id]['rank_image'] = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!isset($user_cache[$poster_id]['profile']) && $poster_id)
|
||||
// Cache various user specific data ... so we don't have to recompute
|
||||
// this each time the same user appears on this page
|
||||
if (!isset($user_cache[$poster_id]['profile']) && $poster_id != ANONYMOUS)
|
||||
{
|
||||
$temp_url = "ucp.$phpEx$SID&mode=viewprofile&u=$poster_id";
|
||||
$user_cache[$poster_id]['profile_img'] = '<a href="' . $temp_url . '">' . $user->img('icon_profile', $user->lang['READ_PROFILE']) . '</a>';
|
||||
$user_cache[$poster_id]['profile'] = '<a href="' . $temp_url . '">' . $user->lang['READ_PROFILE'] . '</a>';
|
||||
|
||||
$temp_url = "privmsg.$phpEx$SID&mode=post&u=$poster_id";
|
||||
$temp_url = "ucp.$phpEx$SID&mode=message&action=send&u=$poster_id";
|
||||
$user_cache[$poster_id]['pm_img'] = '<a href="' . $temp_url . '">' . $user->img('icon_pm', $user->lang['SEND_PRIVATE_MESSAGE']) . '</a>';
|
||||
$user_cache[$poster_id]['pm'] = '<a href="' . $temp_url . '">' . $user->lang['SEND_PRIVATE_MESSAGE'] . '</a>';
|
||||
|
||||
@ -681,13 +643,12 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Non-user specific images/text
|
||||
$temp_url = 'posting.' . $phpEx . $SID . '&mode=quote&p=' . $row['post_id'];
|
||||
$quote_img = '<a href="' . $temp_url . '">' . $user->img('icon_quote', $user->lang['REPLY_WITH_QUOTE']) . '</a>';
|
||||
$quote = '<a href="' . $temp_url . '">' . $user->lang['REPLY_WITH_QUOTE'] . '</a>';
|
||||
|
||||
if (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id)) || $auth->acl_gets('m_edit', 'a_', $forum_id))
|
||||
if (($user->data['user_id'] == $poster_id && $auth->acl_gets('f_edit', $forum_id)) || $auth->acl_gets('m_edit', 'a_', $forum_id))
|
||||
{
|
||||
$temp_url = "posting.$phpEx$SID&mode=edit&f=" . $row['forum_id'] . "&p=" . $row['post_id'];
|
||||
$edit_img = '<a href="' . $temp_url . '">' . $user->img('icon_edit', $user->lang['EDIT_DELETE_POST']) . '</a>';
|
||||
@ -724,7 +685,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Does post have an attachment? If so, add it to the list
|
||||
if ($row['post_attach'])
|
||||
{
|
||||
@ -732,14 +692,12 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Parse the message and subject
|
||||
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : '';
|
||||
$message = $row['post_text'];
|
||||
$bbcode_uid = $row['bbcode_uid'];
|
||||
|
||||
|
||||
|
||||
// If the board has HTML off but the post has HTML
|
||||
// on then we process it, else leave it alone
|
||||
if (!$auth->acl_get('f_html', $forum_id))
|
||||
@ -760,7 +718,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
$message = (empty($row['enable_smilies']) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
|
||||
|
||||
|
||||
|
||||
// Highlight active words (primarily for search)
|
||||
if ($highlight_match)
|
||||
{
|
||||
@ -770,7 +727,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Replace naughty words such as farty pants
|
||||
if (sizeof($censors))
|
||||
{
|
||||
@ -795,7 +751,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Signature
|
||||
if (!isset($user_cache[$poster_id]['sig']))
|
||||
{
|
||||
@ -824,7 +779,6 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Define the little post icon
|
||||
$mini_post_img = ($row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('goto_post_new', $user->lang['New_post']) : $user->img('goto_post', $user->lang['Post']);
|
||||
|
||||
@ -881,7 +835,7 @@ if ($row = $db->sql_fetchrow($result))
|
||||
'YIM_IMG' => $user_cache[$poster_id]['yim_img'],
|
||||
'YIM' => $user_cache[$poster_id]['yim'],
|
||||
|
||||
'POST_ICON' => (!empty($row['icon_id']) ) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'POST_ICON' => (!empty($row['icon_id'])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
|
||||
'L_MINI_POST_ALT' => $mini_post_alt,
|
||||
|
||||
@ -897,20 +851,9 @@ if ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($user->lang['No_posts_topic']);
|
||||
trigger_error($user->lang['NO_TOPIC']);
|
||||
}
|
||||
|
||||
$rating = '';
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$rating_text = array(0 => $user->lang['SPAM'], 5 => $user->lang['EXCELLENT']);
|
||||
|
||||
$sql = "SELECT rating
|
||||
FROM " . TOPICS_RATINGS_TABLE . "
|
||||
WHERE user_id = " . $user->data['user_id'] . "
|
||||
AND post_id IN ($post_id_sql)";
|
||||
// $result = $db->sql_query($sql);
|
||||
}
|
||||
|
||||
// If we have attachments, grab them ... based on Acyd Burns 2.0.x Mod
|
||||
if (sizeof($attach_list))
|
||||
@ -948,15 +891,39 @@ if (sizeof($attach_list))
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
// Mark topics read
|
||||
markread('topic', $forum_id, $topic_id, $forum_topic_data['topic_last_post_id']);
|
||||
|
||||
|
||||
// Update the topic view counter
|
||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
||||
SET topic_views = topic_views + 1
|
||||
WHERE topic_id = $topic_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
// Mozilla navigation bar
|
||||
$nav_links['prev'] = array(
|
||||
'url' => $view_prev_topic_url,
|
||||
'title' => $user->lang['View_previous_topic']
|
||||
);
|
||||
$nav_links['next'] = array(
|
||||
'url' => $view_next_topic_url,
|
||||
'title' => $user->lang['View_next_topic']
|
||||
);
|
||||
$nav_links['up'] = array(
|
||||
'url' => $view_forum_url,
|
||||
'title' => $forum_name
|
||||
);
|
||||
|
||||
|
||||
// Change encoding if appropriate
|
||||
if ($force_encoding != '')
|
||||
{
|
||||
$user->lang['ENCODING'] = $force_encoding;
|
||||
}
|
||||
|
||||
// Output the page
|
||||
$page_title = $user->lang['View_topic'] .' - ' . $topic_title;
|
||||
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||
@ -968,6 +935,4 @@ make_jumpbox('viewforum.'.$phpEx, $forum_id);
|
||||
|
||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||
|
||||
//, 'header' => 'overall_header.tpl', 'footer' => 'overall_footer.tpl'
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user