diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php
index 39cc110b70..c320e0f9ec 100644
--- a/phpBB/develop/benchmark.php
+++ b/phpBB/develop/benchmark.php
@@ -263,61 +263,51 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
$post_message = prepare_message($text, $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
- $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig)
- VALUES ($new_topic_id, $forum_id, $user_id, '$post_username', $current_time, '$user_ip', '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig)";
+ $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, attach_id, icon_id, post_username, post_time, poster_ip, post_approved, bbcode_uid, enable_bbcode, enable_html, enable_smilies, enable_sig, post_subject, post_text)
+ VALUES ($new_topic_id, $forum_id, $user_id, 0, 0, '$post_username', $current_time, '$user_ip', 1, '$bbcode_uid', $bbcode_on, $html_on, $smilies_on, $attach_sig, '$post_subject', '$post_message')";
$result = $db->sql_query($sql);
- if($result)
+ if ($result)
{
$new_post_id = $db->sql_nextid();
- $sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, post_text)
- VALUES ($new_post_id, '$post_subject', '$post_message')";
-
+ $sql = "UPDATE " . TOPICS_TABLE . "
+ SET topic_last_post_id = $new_post_id";
+ if($mode == "reply")
+ {
+ $sql .= ", topic_replies = topic_replies + 1 ";
+ }
+ $sql .= " WHERE topic_id = $new_topic_id";
+
if($db->sql_query($sql))
{
- $sql = "UPDATE " . TOPICS_TABLE . "
- SET topic_last_post_id = $new_post_id";
- if($mode == "reply")
+ $sql = "UPDATE " . FORUMS_TABLE . "
+ SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
+ if($mode == "newtopic")
{
- $sql .= ", topic_replies = topic_replies + 1 ";
+ $sql .= ", forum_topics = forum_topics + 1";
}
- $sql .= " WHERE topic_id = $new_topic_id";
+ $sql .= " WHERE forum_id = $forum_id";
if($db->sql_query($sql))
{
- $sql = "UPDATE " . FORUMS_TABLE . "
- SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
- if($mode == "newtopic")
- {
- $sql .= ", forum_topics = forum_topics + 1";
- }
- $sql .= " WHERE forum_id = $forum_id";
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_posts = user_posts + 1
+ WHERE user_id = " . $user_id;
- if($db->sql_query($sql))
+ if($db->sql_query($sql, END_TRANSACTION))
{
- $sql = "UPDATE " . USERS_TABLE . "
- SET user_posts = user_posts + 1
- WHERE user_id = " . $user_id;
-
- if($db->sql_query($sql, END_TRANSACTION))
- {
- // SUCCESS.
- return true;
- }
- else
- {
- message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
- }
+ // SUCCESS.
+ return true;
}
else
{
- message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, "Error updating users table", "", __LINE__, __FILE__, $sql);
}
}
else
{
- message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, "Error updating forums table", "", __LINE__, __FILE__, $sql);
}
}
else
@@ -329,14 +319,13 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
WHERE post_id = $new_post_id";
$db->sql_query($sql);
}
- message_die(GENERAL_ERROR, "Error inserting data into posts text table", "", __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, "Error updating topics table", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_ERROR, "Error inserting data into posts table", "", __LINE__, __FILE__, $sql);
}
-
}
@@ -470,8 +459,4 @@ function make_user($username)
}
-
-
-
-
-?>
+?>
\ No newline at end of file
diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php
index 8cfea84f02..d8a2dfc11d 100644
--- a/phpBB/develop/search_fill.php
+++ b/phpBB/develop/search_fill.php
@@ -33,7 +33,7 @@ $synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.
// Fetch a batch of posts_text entries
//
$sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
- FROM ". POSTS_TEXT_TABLE;
+ FROM ". POSTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
$error = $db->sql_error();
@@ -56,7 +56,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
$batchcount++;
$sql = "SELECT *
- FROM " . POSTS_TEXT_TABLE . "
+ FROM " . POSTS_TABLE . "
WHERE post_id
BETWEEN $batchstart
AND $batchend";
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index 6fad9eb986..d91655ff04 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -16,7 +16,6 @@ function login_db(&$username, &$password)
if ( $row = $db->sql_fetchrow($result) )
{
$db->sql_freeresult($result);
-
if ( md5($password) == $row['user_password'] && $row['user_active'] )
{
return $row;
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index fed171e5a8..34b9a9d108 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -232,9 +232,9 @@ function prune($forum_id, $prune_date, $sql_topics = '')
$pruned_posts = $db->sql_affectedrows();
- $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
+/* $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($sql_posts)";
- $db->sql_query($sql);
+ $db->sql_query($sql);*/
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id IN ($sql_posts)";
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index cb021f0137..08bc192c50 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -43,7 +43,6 @@ function display_forums($root_data = '', $display_moderators = TRUE)
lr.user_id = " . $user->data['user_id'] . "
AND (f.forum_id = lr.forum_id OR f.forum_id = -lr.forum_id)
AND lr.lastread_time >= f.forum_last_post_time)";
-
// Temp fix for index
//$where_sql .= ' GROUP BY f.forum_id';
}
@@ -154,7 +153,6 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$forum_id = $row['forum_id'];
$unread_topics = ($user->data['user_id'] && $row['lastread_time'] < $row['forum_last_post_time'] ) ? TRUE : FALSE;
-
$folder_image = ($unread_topics) ? 'forum_new' : 'forum';
$folder_alt = ($unread_topics) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 32b776fbcf..78446897b7 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -24,36 +24,36 @@
class parse_message
{
var $bbcode_tpl = null;
+ var $message_mode = 0; // introduce constant or string ? 'posting'/'pm'
+ function parse_message($message_type)
+ {
+ $this->message_mode = $message_type;
+ }
+
function parse(&$message, $html, $bbcode, $uid, $url, $smilies)
{
- global $config, $db, $user;
+ global $config, $db, $user, $_FILE;
$warn_msg = '';
// Do some general 'cleanup' first before processing message,
// e.g. remove excessive newlines(?), smilies(?)
- $match = array();
- $replace = array();
-
- $match[] = '#sid=[a-z0-9]*?&?#';
- $replace[] = '';
- $match[] = "#([\r\n][\s]+){3,}#";
- $replace[] = "\n\n";
+ $match = array('#sid=[a-z0-9]*?&?#', "#([\r\n][\s]+){3,}#");
+ $replace = array('', "\n\n");
$message = trim(preg_replace($match, $replace, $message));
// Message length check
if (!strlen($message) || ($config['max_post_chars'] && strlen($message) > intval($config['max_post_chars'])))
{
- $warn_msg .= (($warn_msg != '') ? '
' : '') . (!strlen($message)) ? $user->lang['Too_few_chars'] : $user->lang['Too_many_chars'];
+ $warn_msg .= (($warn_msg != '') ? '
' : '') . (!strlen($message)) ? $user->lang['TOO_FEW_CHARS'] : $user->lang['TOO_MANY_CHARS'];
}
// Smiley check
if (intval($config['max_post_smilies']) && $smilies )
{
- $sql = "SELECT code
- FROM " . SMILIES_TABLE;
+ $sql = "SELECT code FROM " . SMILIES_TABLE;
$result = $db->sql_query($sql);
$match = 0;
@@ -66,7 +66,7 @@ class parse_message
if ($match > intval($config['max_post_smilies']))
{
- $warn_msg .= (($warn_msg != '') ? '
' : '') . $user->lang['Too_many_smilies'];
+ $warn_msg .= (($warn_msg != '') ? '
' : '') . $user->lang['TOO_MANY_SMILIES'];
break;
}
}
@@ -82,7 +82,7 @@ class parse_message
$warn_msg .= (($warn_msg != '') ? '
' : '') . $this->html($message, $html);
$warn_msg .= (($warn_msg != '') ? '
' : '') . $this->bbcode($message, $bbcode, $uid);
$warn_msg .= (($warn_msg != '') ? '
' : '') . $this->emoticons($message, $smilies);
- $warn_msg .= (($warn_msg != '') ? '
' : '') . $this->magic_url($message, $url);
+ $warn_msg .= (($warn_msg != '') ? '
' : '') . $this->magic_url($message, trim($url));
$warn_msg .= (($warn_msg != '') ? '
' : '') . $this->attach($_FILE);
return $warn_msg;
@@ -154,7 +154,8 @@ class parse_message
{
global $db, $user;
- $result = $db->sql_query('SELECT * FROM ' . SMILIES_TABLE);
+ $sql = "SELECT * FROM " . SMILIES_TABLE;
+ $result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
@@ -162,7 +163,7 @@ class parse_message
do
{
$match[] = "#(?<=.\W|\W.|^\W)" . preg_quote($row['code'], '#') . "(?=.\W|\W.|\W$)#";
- $replace[] = '';
+ $replace[] = '
';
}
while ($row = $db->sql_fetchrow($result));
@@ -173,14 +174,10 @@ class parse_message
return;
}
- // Based off of Acyd Burns Mod
function attach($file_ary)
{
global $config;
- $allowed_ext = explode(',', $config['attach_ext']);
-
-
}
}
@@ -453,7 +450,7 @@ function generate_smilies($mode)
if ($mode == 'window')
{
- $page_title = $user->lang['Review_topic'] . " - $topic_title";
+ $page_title = $user->lang['TOPIC_REVIEW'] . " - $topic_title";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
diff --git a/phpBB/install/install.php b/phpBB/install/install.php
index 95c612cc55..1b458d278d 100644
--- a/phpBB/install/install.php
+++ b/phpBB/install/install.php
@@ -581,15 +581,15 @@ else
$check_extensions = array();
$suffix = ( (defined('PHP_OS')) && (eregi('win', PHP_OS)) ) ? '.dll' : '.so';
- for ($i = 0; $i < count($check_extensions); $i++)
+ foreach ($check_extensions as $extension)
{
- if (!@extension_loaded($check_extensions[$i]))
+ if (!@extension_loaded($extension))
{
if ( (!@ini_get('safe_mode')) && (@ini_get('enable_dl')) )
{
- if (@dl($check_extensions[$i] . $suffix))
+ if (@dl($extension . $suffix))
{
- $load_extensions .= ($load_extensions == '') ? $check_extensions[$i] . $suffix : ',' . $check_extensions[$i] . $suffix;
+ $load_extensions .= ($load_extensions == '') ? $extension . $suffix : ',' . $extension . $suffix;
}
}
}
diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php
index 1bc109a615..5d463c389a 100644
--- a/phpBB/language/en/lang_main.php
+++ b/phpBB/language/en/lang_main.php
@@ -302,7 +302,7 @@ $lang = array_merge($lang, array(
'MESSAGE_BODY' => 'Message body',
'MESSAGE_BODY_EXPLAIN' => 'Enter your message here, it may contain no more than %d characters.',
- 'Topic_review' => 'Topic review',
+ 'TOPIC_REVIEW' => 'Topic review',
'TOPIC_ICON' => 'Topic icon',
'POST_ICON' => 'Post icon',
'No_post_mode' => 'No post mode specified',
@@ -320,9 +320,9 @@ $lang = array_merge($lang, array(
'Empty_subject' => 'You must specify a subject when posting a new topic',
'To_long_subject' => 'The subject is too long it must be 60 characters or less',
'EMPTY_MESSAGE' => 'You must enter a message when posting',
- 'Too_few_chars' => 'Your message contains too few characters',
- 'Too_many_chars' => 'Your message contains too many characters',
- 'Too_many_smilies' => 'Your message contains too many emoticons',
+ 'TOO_FEW_CHARS' => 'Your message contains too few characters',
+ 'TOO_MANY_CHARS' => 'Your message contains too many characters',
+ 'TOO_MANY_SMILIES' => 'Your message contains too many emoticons',
'Forum_locked' => 'This forum is locked you cannot post, reply to or edit topics',
'Topic_locked' => 'This topic is locked you cannot edit posts or make replies',
'No_post_id' => 'No post ID was specified',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index acff7fd940..403ced95dc 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -22,18 +22,22 @@
// TODO for 2.2:
//
// * deletion of posts/polls
-// * topic review additions, quoting, etc.?
+// * topic review additions -> quoting from previous posts ?
// * post preview (poll preview too?)
-// * check for reply since started posting upon submission?
+// * check for reply since started posting upon submission and display of 'between-posts' to allow re-defining of post
// * hidden form element containing sid to prevent remote posting - Edwin van Vliet
-// * attachments -> Acyd Burns Mod functionality
+// * Attachments
// * bbcode parsing -> see functions_posting.php
// * lock topic option within posting
// * multichoice polls
// * permission defined ability for user to add poll options
// * Spellcheck? aspell? or some such?
+// * Posting approval
+// * Report to Admin Checkbox/Button for Moderation ?
+// * After Submit got clicked, disable the button (prevent double-posts), could be solved in a more elegant way
define('IN_PHPBB', true);
+
if (count($_POST))
{
define('NEED_SID', true);
@@ -71,7 +75,7 @@ if (!empty($_REQUEST['cancel']))
switch ($mode)
{
case 'post':
- if (empty($forum_id))
+ if (!$forum_id)
{
trigger_error($user->lang['NO_FORUM']);
}
@@ -82,7 +86,7 @@ switch ($mode)
break;
case 'reply':
- if (empty($topic_id))
+ if (!$topic_id)
{
trigger_error($user->lang['NO_TOPIC']);
}
@@ -96,7 +100,7 @@ switch ($mode)
case 'quote':
case 'edit':
case 'delete':
- if (empty($post_id))
+ if (!$post_id)
{
trigger_error($user->lang['NO_POST']);
}
@@ -109,7 +113,7 @@ switch ($mode)
break;
case 'topicreview':
- if (!isset($topic_id))
+ if (!$topic_id)
{
trigger_error($user->lang['NO_TOPIC']);
}
@@ -138,9 +142,9 @@ if ($sql != '')
if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
{
$sql = "SELECT topic_id
- FROM " . TOPICS_WATCH_TABLE . "
- WHERE topic_id = " . intval($topic_id) . "
- AND user_id = " . $user->data['user_id'];
+ FROM " . TOPICS_WATCH_TABLE . "
+ WHERE topic_id = " . intval($topic_id) . "
+ AND user_id = " . $user->data['user_id'];
$result = $db->sql_query($sql);
$notify_set = ($db->sql_fetchrow($result)) ? true : false;
@@ -150,8 +154,8 @@ if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
if ($mode == 'edit' && !empty($poll_start))
{
$sql = "SELECT *
- FROM phpbb_poll_results
- WHERE topic_id = " . intval($topic_id);
+ FROM phpbb_poll_results
+ WHERE topic_id = " . intval($topic_id);
$result = $db->sql_query($sql);
$poll_options = array();
@@ -198,6 +202,7 @@ if (isset($_REQUEST['post']))
{
// If replying/quoting and last post id has changed
// give user option of continuing submit or return to post
+ // notify and show user the post made between his request and the final submit
if (($mode == 'reply' || $mode == 'quote') && intval($topic_last_post_id) != intval($topic_cur_post_id))
{
@@ -205,7 +210,7 @@ if (isset($_REQUEST['post']))
$err_msg = '';
$current_time = time();
- $parse_msg = new parse_message();
+ $parse_msg = new parse_message(0);
$search = new fulltext_search();
// Grab relevant submitted data
@@ -713,6 +718,7 @@ $template->assign_vars(array(
'S_NOTIFY_ALLOWED' => ($user->data['user_id'] != ANONYMOUS) ? true : false,
'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $topic_last_post_id && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', intval($forum_id))) || $auth->acl_gets('m_delete', 'a_', intval($forum_id)))) ? true : false,
'S_TYPE_TOGGLE' => $topic_type_toggle,
+ 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_gets('m_lock', 'a_', intval($forum_id)))) ? true : false,
'S_DISPLAY_REVIEW' => ($mode == 'reply' || $mode == 'quote') ? true : false,
'S_TOPIC_ID' => intval($topic_id),
diff --git a/phpBB/search.php b/phpBB/search.php
index b4ca6dd8be..bb5b08347a 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -586,10 +586,9 @@ if ( $search_keywords != '' || $search_author != '' || $search_id )
{
if ( $show_results == 'posts' )
{
- $sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
- FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
+ $sql = "SELECT p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
+ FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE p.post_id IN ($search_results)
- AND pt.post_id = p.post_id
AND f.forum_id = p.forum_id
AND p.topic_id = t.topic_id
AND p.poster_id = u.user_id";
diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html
index f937697a33..ed41348aeb 100644
--- a/phpBB/templates/subSilver/posting_body.html
+++ b/phpBB/templates/subSilver/posting_body.html
@@ -194,6 +194,12 @@ function checkForm()