diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 21a1a8f895..fc977093f5 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -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 tag linking
- * to that URL
- * - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML 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\\2://\\3", $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", "\\1www.\\2.\\3\\4", $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\\2@\\3", $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[] = '
';
- }
-
- 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;
-}
-
?>
\ No newline at end of file
diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php
index 110f2d78e0..1bc109a615 100644
--- a/phpBB/language/en/lang_main.php
+++ b/phpBB/language/en/lang_main.php
@@ -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
Click on the Post New Topic 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
Click on the Post New Topic 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 %s who is on your ignore list. To display this post click %sHERE%s.',
'POST_BELOW_KARMA' => 'This post was made by %1$s whose karma rating of %2$d 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 %1$s 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',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index a8d69b8746..acff7fd940 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -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);
diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html
index 2288b40dff..f937697a33 100644
--- a/phpBB/templates/subSilver/posting_body.html
+++ b/phpBB/templates/subSilver/posting_body.html
@@ -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()
|
|
|
- |
+ |
+ |
- |