diff --git a/phpBB/common.php b/phpBB/common.php
index 1548e2b8fb..2e954adad4 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -108,6 +108,7 @@ else
$board_config['default_lang'] = stripslashes($config['default_lang']);
$board_config['board_email'] = stripslashes(str_replace("
", "\n", $config['email_sig']));
$board_config['board_email_from'] = stripslashes($config['email_from']);
+ $board_config['flood_interval'] = $config['flood_interval'];
}
include('language/lang_'.$board_config['default_lang'].'.'.$phpEx);
diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql
index 0114912e9b..3ce52dcb5b 100644
--- a/phpBB/db/mysql_schema.sql
+++ b/phpBB/db/mysql_schema.sql
@@ -57,6 +57,7 @@ CREATE TABLE phpbb_config (
hot_threshold int(10),
email_sig varchar(255),
email_from varchar(100),
+ flood_interval int(4) NOT NULL,
default_theme int(11) DEFAULT '1' NOT NULL,
default_lang varchar(255),
default_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL,
@@ -161,6 +162,7 @@ DROP TABLE IF EXISTS phpbb_posts_text;
CREATE TABLE phpbb_posts_text (
post_id int(10) DEFAULT '0' NOT NULL,
+ post_subject varchar(255),
post_text text,
PRIMARY KEY (post_id)
);
diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql
index d526a701f3..c5100bbeca 100644
--- a/phpBB/db/postgres_schema.sql
+++ b/phpBB/db/postgres_schema.sql
@@ -5,22 +5,22 @@
$Id$
*/
-CREATE SEQUENCE phpbb_banlist_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_categories_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_config_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_disallow_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_forums_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_posts_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_privmsgs_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_ranks_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_smilies_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_themes_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_topics_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_users_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-CREATE SEQUENCE phpbb_words_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_banlist_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_categories_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_config_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_disallow_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_forums_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_posts_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_privmsgs_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_ranks_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_smilies_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_themes_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_topics_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_users_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
+CREATE SEQUENCE phpbb_words_id_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1;
-/* --------------------------------------------------------
- Table structure for table phpbb_auth_forums
+/* --------------------------------------------------------
+ Table structure for table phpbb_auth_forums
-------------------------------------------------------- */
CREATE TABLE phpbb_auth_forums (
forum_id int4 DEFAULT '0' NOT NULL,
@@ -33,8 +33,8 @@ CREATE TABLE phpbb_auth_forums (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_auth_groups
+/* --------------------------------------------------------
+ Table structure for table phpbb_auth_groups
-------------------------------------------------------- */
CREATE TABLE phpbb_auth_groups (
group_id int4 DEFAULT '0' NOT NULL,
@@ -49,8 +49,8 @@ CREATE TABLE phpbb_auth_groups (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_auth_hosts
+/* --------------------------------------------------------
+ Table structure for table phpbb_auth_hosts
-------------------------------------------------------- */
CREATE TABLE phpbb_auth_hosts (
host_id int2 DEFAULT '0' NOT NULL,
@@ -60,8 +60,8 @@ CREATE TABLE phpbb_auth_hosts (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_banlist
+/* --------------------------------------------------------
+ Table structure for table phpbb_banlist
-------------------------------------------------------- */
CREATE TABLE phpbb_banlist (
ban_id int4 DEFAULT nextval('phpbb_banlist_id_seq'::text) NOT NULL,
@@ -75,8 +75,8 @@ CREATE TABLE phpbb_banlist (
CREATE INDEX ban_userid_phpbb_banlist_index ON phpbb_banlist (ban_userid);
-/* --------------------------------------------------------
- Table structure for table phpbb_categories
+/* --------------------------------------------------------
+ Table structure for table phpbb_categories
-------------------------------------------------------- */
CREATE TABLE phpbb_categories (
cat_id int4 DEFAULT nextval('phpbb_categories_id_seq'::text) NOT NULL,
@@ -86,8 +86,8 @@ CREATE TABLE phpbb_categories (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_config
+/* --------------------------------------------------------
+ Table structure for table phpbb_config
-------------------------------------------------------- */
CREATE TABLE phpbb_config (
config_id int2 NOT NULL,
@@ -108,13 +108,14 @@ CREATE TABLE phpbb_config (
system_timezone int4 NOT NULL,
sys_template varchar(50) NOT NULL,
override_themes int2 NOT NULL,
+ flood_interval int NOT NULL,
selected int2 NOT NULL,
CONSTRAINT phpbb_config_pkey PRIMARY KEY (config_id)
);
-/* --------------------------------------------------------
- Table structure for table phpbb_disallow
+/* --------------------------------------------------------
+ Table structure for table phpbb_disallow
-------------------------------------------------------- */
CREATE TABLE phpbb_disallow (
disallow_id int4 DEFAULT nextval('phpbb_disallow_id_s'::text) NOT NULL,
@@ -123,8 +124,8 @@ CREATE TABLE phpbb_disallow (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_forum_access
+/* --------------------------------------------------------
+ Table structure for table phpbb_forum_access
-------------------------------------------------------- */
CREATE TABLE phpbb_forum_access (
forum_id int4 DEFAULT '0' NOT NULL,
@@ -134,8 +135,8 @@ CREATE TABLE phpbb_forum_access (
CREATE INDEX _phpbb_forum_access_index ON phpbb_forum_access (forum_id, user_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_forum_mods
+/* --------------------------------------------------------
+ Table structure for table phpbb_forum_mods
-------------------------------------------------------- */
CREATE TABLE phpbb_forum_mods (
forum_id int4 DEFAULT '0' NOT NULL,
@@ -145,8 +146,8 @@ CREATE TABLE phpbb_forum_mods (
CREATE INDEX _phpbb_forum_mods_index ON phpbb_forum_mods (forum_id, user_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_forums
+/* --------------------------------------------------------
+ Table structure for table phpbb_forums
-------------------------------------------------------- */
CREATE TABLE phpbb_forums (
forum_id int4 DEFAULT nextval('phpbb_forums_id_seq'::text) NOT NULL,
@@ -167,8 +168,8 @@ CREATE INDEX forum_type_phpbb_forums_index ON phpbb_forums (forum_type);
CREATE INDEX forums_order_phpbb_forums_index ON phpbb_forums (forum_order);
-/* --------------------------------------------------------
- Table structure for table phpbb_groups
+/* --------------------------------------------------------
+ Table structure for table phpbb_groups
-------------------------------------------------------- */
CREATE TABLE phpbb_groups (
group_id int4 DEFAULT '0' NOT NULL,
@@ -178,8 +179,8 @@ CREATE TABLE phpbb_groups (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_posts
+/* --------------------------------------------------------
+ Table structure for table phpbb_posts
-------------------------------------------------------- */
CREATE TABLE phpbb_posts (
post_id int4 DEFAULT nextval('phpbb_posts_id_seq'::text) NOT NULL,
@@ -197,8 +198,8 @@ CREATE INDEX poster_id_phpbb_posts_index ON phpbb_posts (poster_id);
CREATE INDEX topic_id_phpbb_posts_index ON phpbb_posts (topic_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_posts_text
+/* --------------------------------------------------------
+ Table structure for table phpbb_posts_text
-------------------------------------------------------- */
CREATE TABLE phpbb_posts_text (
post_id int4 DEFAULT '0' NOT NULL,
@@ -208,8 +209,8 @@ CREATE TABLE phpbb_posts_text (
CREATE INDEX post_id_phpbb_posts_text_index ON phpbb_posts_text (post_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_privmsgs
+/* --------------------------------------------------------
+ Table structure for table phpbb_privmsgs
-------------------------------------------------------- */
CREATE TABLE phpbb_privmsgs (
msg_id int4 DEFAULT nextval('phpbb_privmsgs_id_seq'::text) NOT NULL,
@@ -225,8 +226,8 @@ CREATE TABLE phpbb_privmsgs (
CREATE INDEX to_userid_phpbb_privmsgs_index ON phpbb_privmsgs (to_userid);
-/* --------------------------------------------------------
- Table structure for table phpbb_ranks
+/* --------------------------------------------------------
+ Table structure for table phpbb_ranks
-------------------------------------------------------- */
CREATE TABLE phpbb_ranks (
rank_id int4 DEFAULT nextval('phpbb_ranks_id_seq'::text) NOT NULL,
@@ -242,8 +243,8 @@ CREATE INDEX rank_max_phpbb_ranks_index ON phpbb_ranks (rank_max);
CREATE INDEX rank_min_phpbb_ranks_index ON phpbb_ranks (rank_min);
-/* --------------------------------------------------------
- Table structure for table phpbb_session
+/* --------------------------------------------------------
+ Table structure for table phpbb_session
-------------------------------------------------------- */
CREATE TABLE phpbb_session (
session_id char(32) DEFAULT '0' NOT NULL,
@@ -258,8 +259,8 @@ CREATE TABLE phpbb_session (
CREATE INDEX session_user_id ON phpbb_session (session_user_id);
CREATE INDEX session_id_ip_user_id ON phpbb_session (session_id, session_ip, session_user_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_session_keys
+/* --------------------------------------------------------
+ Table structure for table phpbb_session_keys
-------------------------------------------------------- */
CREATE TABLE phpbb_session_keys (
key_user_id int4 DEFAULT '0' NOT NULL,
@@ -270,8 +271,8 @@ CREATE TABLE phpbb_session_keys (
CREATE INDEX key_ip_phpbb_session_keys_index ON phpbb_session_keys (key_ip);
-/* --------------------------------------------------------
- Table structure for table phpbb_smilies
+/* --------------------------------------------------------
+ Table structure for table phpbb_smilies
-------------------------------------------------------- */
CREATE TABLE phpbb_smilies (
smilies_id int4 DEFAULT nextval('phpbb_smilies_id_seq'::text) NOT NULL,
@@ -282,8 +283,8 @@ CREATE TABLE phpbb_smilies (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_themes
+/* --------------------------------------------------------
+ Table structure for table phpbb_themes
-------------------------------------------------------- */
CREATE TABLE phpbb_themes (
themes_id int4 DEFAULT nextval('phpbb_themes_id_seq'::text) NOT NULL,
@@ -323,8 +324,8 @@ CREATE TABLE phpbb_themes (
CREATE INDEX themes_name_phpbb_themes_index ON phpbb_themes (themes_name);
-/* --------------------------------------------------------
- Table structure for table phpbb_themes_name
+/* --------------------------------------------------------
+ Table structure for table phpbb_themes_name
-------------------------------------------------------- */
CREATE TABLE phpbb_themes_name (
themes_id int4 DEFAULT '0' NOT NULL,
@@ -354,8 +355,8 @@ CREATE TABLE phpbb_themes_name (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_topics
+/* --------------------------------------------------------
+ Table structure for table phpbb_topics
-------------------------------------------------------- */
CREATE TABLE phpbb_topics (
topic_id int4 DEFAULT nextval('phpbb_topics_id_seq'::text) NOT NULL,
@@ -374,8 +375,8 @@ CREATE INDEX _phpbb_topics_index ON phpbb_topics (forum_id, topic_id);
CREATE INDEX forum_id_phpbb_topics_index ON phpbb_topics (forum_id);
-/* --------------------------------------------------------
- Table structure for table phpbb_user_groups
+/* --------------------------------------------------------
+ Table structure for table phpbb_user_groups
-------------------------------------------------------- */
CREATE TABLE phpbb_user_groups (
group_id int4 DEFAULT '0' NOT NULL,
@@ -383,8 +384,8 @@ CREATE TABLE phpbb_user_groups (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_users
+/* --------------------------------------------------------
+ Table structure for table phpbb_users
-------------------------------------------------------- */
CREATE TABLE phpbb_users (
user_id int4 DEFAULT nextval('phpbb_users_id_seq'::text) NOT NULL,
@@ -424,8 +425,8 @@ CREATE TABLE phpbb_users (
);
-/* --------------------------------------------------------
- Table structure for table phpbb_words
+/* --------------------------------------------------------
+ Table structure for table phpbb_words
-------------------------------------------------------- */
CREATE TABLE phpbb_words (
word_id int4 DEFAULT nextval('phpbb_words_id_seq'::text) NOT NULL,
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 95ee824bea..4b77f1ee91 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -28,7 +28,7 @@ function get_db_stat($mode)
switch($mode){
case 'postcount':
- $sql = "SELECT count(*) AS total
+ $sql = "SELECT count(*) AS total
FROM ".POSTS_TABLE;
break;
@@ -44,12 +44,12 @@ function get_db_stat($mode)
FROM ".USERS_TABLE."
WHERE user_id <> " . ANONYMOUS. "
AND user_level <> ". DELETED ."
- ORDER BY user_id DESC
+ ORDER BY user_id DESC
LIMIT 1";
break;
case 'usersonline':
- $sql = "SELECT COUNT(*) AS online
+ $sql = "SELECT COUNT(*) AS online
FROM ".SESSIONS_TABLE;
break;
}
@@ -154,7 +154,7 @@ function init_userprefs($userdata)
{
$theme = setuptheme($userdata['user_theme']);
}
- else
+ else
{
$theme = setuptheme($board_config['default_theme']);
}
@@ -208,10 +208,10 @@ function setuptheme($theme)
{
global $db;
- $sql = "SELECT *
- FROM ".THEMES_TABLE."
+ $sql = "SELECT *
+ FROM ".THEMES_TABLE."
WHERE themes_id = $theme";
-
+
if(!$result = $db->sql_query($sql))
{
return(0);
@@ -234,14 +234,14 @@ function generate_activation_key()
$max_elements = count($chars) - 1;
srand((double)microtime()*1000000);
-
+
$act_key = '';
for($i = 0; $i < 8; $i++)
{
$act_key .= $chars[rand(0,$max_elements)];
}
$act_key_md = md5($act_key);
-
+
return($act_key_md);
}
@@ -276,7 +276,8 @@ function create_date($format, $gmepoch, $tz)
//
function get_gmt_ts()
{
- return(gmmktime(gmdate("H, i, s, m, d, Y")));
+ $time = time();
+ return($time);
}
//
@@ -287,7 +288,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
{
global $l_prevpage, $l_nextpage;
-
+
$total_pages = ceil($num_items/$per_page);
if($total_pages == 1)
{
@@ -321,7 +322,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
{
$page_string_prepend .= "" . ( ($i == 0) ? ($i+1) : $i) . " - " . ($i+9) . ", ";
}
-
+
$page_string = $page_string_prepend . $page_string;
}
@@ -336,10 +337,10 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$page_string_append .= ", ";
}
}
-
+
$page_string .= $page_string_append;
}
-
+
if($add_prevnext_text)
{
if($on_page > 1)
diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php
index d5cf1acf87..36b13cdefa 100755
--- a/phpBB/language/lang_english.php
+++ b/phpBB/language/lang_english.php
@@ -365,7 +365,10 @@ $l_htmlis = "$l_html is";
$l_bbcodeis = "$l_bbcode is";
$l_notify = "Notify by email when replies are posted";
-// "
+
+$l_flooderror = "Your last post was less then ".$board_config['flood_interval']." seconds ago. You must wait befor you post again!";
+
+
// Newtopic
$l_postnew = "Post New Topic";
$l_postnewin = "Post New Topic in:";
diff --git a/phpBB/posting.php b/phpBB/posting.php
index a74783ed08..129103e240 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -80,7 +80,6 @@ function prepare_message($message, $html_on, $bbocde_on, $smile_on, $bbcode_uid
// End Posting specific functions.
//
-
//
// Put AUTH code here
//
@@ -88,11 +87,35 @@ function prepare_message($message, $html_on, $bbocde_on, $smile_on, $bbcode_uid
$error = FALSE;
//
-// Prepare our message and subject on a 'submit'
+// Prepare our message and subject on a 'submit'
//
if(isset($HTTP_POST_VARS['submit']))
{
- $subject = trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['subject'])));
+ //
+ // Flood control
+ //
+ if($mode != 'editpost')
+ {
+ $enc_ip = encode_ip($user_ip);
+ $sql = "SELECT max(post_time) AS last_post_time FROM ".POSTS_TABLE." WHERE poster_ip = '$enc_ip'";
+ if($result = $db->sql_query($sql))
+ {
+ $db_row = $db->sql_fetchrowset($result);
+ $last_post_time = $db_row[0]['last_post_time'];
+ $current_time = get_gmt_ts();
+
+ if(($current_time - $last_post_time) < $board_config['flood_interval'])
+ {
+ $error = TRUE;
+ $error_msg = $l_flooderror;
+ }
+ }
+ }
+ //
+ // End: Flood control
+ //
+
+ $subject = trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['subject'])));
if($mode == 'newtopic' && empty($subject))
{
$error = TRUE;
@@ -102,7 +125,7 @@ if(isset($HTTP_POST_VARS['submit']))
}
$error_msg .= $l_emptysubj;
}
-
+
if(!empty($HTTP_POST_VARS['message']))
{
if(!$error)
@@ -125,7 +148,7 @@ if(isset($HTTP_POST_VARS['submit']))
$uid = make_bbcode_uid();
$bbocde_on = TRUE;
}
-
+
if(isset($HTTP_POST_VARS['disable_smile']))
{
$smile_on = FALSE;
@@ -136,7 +159,7 @@ if(isset($HTTP_POST_VARS['submit']))
}
$message = prepare_message($HTTP_POST_VARS['message'], $html_on, $bbocde_on, $smile_on, $uid);
-
+
if(isset($HTTP_POST_VARS['attach_sig']) && !empty($userdata['user_sig']))
{
$message .= "[addsig]";
@@ -164,7 +187,7 @@ switch($mode)
case 'newtopic':
$page_title = " $l_postnew";
$section_title = $l_postnewin;
-
+
if(isset($HTTP_POST_VARS['submit']) && !$error)
{
$topic_time = get_gmt_ts();
@@ -181,7 +204,7 @@ switch($mode)
if($db->sql_query($sql))
{
$new_post_id = $db->sql_nextid();
- $sql = "INSERT INTO ".POSTS_TEXT_TABLE." VALUES ($new_post_id, '".$message."')";
+ $sql = "INSERT INTO ".POSTS_TEXT_TABLE." (post_id, post_subject, post_text) VALUES ($new_post_id, '".$subject."', '".$message."')";
if($db->sql_query($sql))
{
$sql = "UPDATE ".TOPICS_TABLE." SET topic_last_post_id = $new_post_id WHERE topic_id = $new_topic_id";
@@ -278,7 +301,7 @@ switch($mode)
case 'reply':
$page_title = " $l_reply";
$section_title = $l_postreplyto;
-
+
if(isset($HTTP_POST_VARS['submit']) && !$error)
{
$new_topic_id = $HTTP_POST_VARS[POST_TOPIC_URL];
@@ -290,7 +313,7 @@ switch($mode)
if($db->sql_query($sql))
{
$new_post_id = $db->sql_nextid();
- $sql = "INSERT INTO ".POSTS_TEXT_TABLE." VALUES ($new_post_id, '".$message."')";
+ $sql = "INSERT INTO ".POSTS_TEXT_TABLE." (post_id, post_subject, post_text) VALUES ($new_post_id, '".$subject."', '".$message."')";
if($db->sql_query($sql))
{
$sql = "UPDATE ".TOPICS_TABLE." SET topic_last_post_id = $new_post_id, topic_replies = topic_replies + 1 WHERE topic_id = $new_topic_id";
@@ -301,7 +324,7 @@ switch($mode)
{
if($userdata['user_id'] != ANONYMOUS)
{
-
+
$sql = "UPDATE ".USERS_TABLE." SET user_posts = user_posts + 1 WHERE user_id = ".$userdata['user_id'];
$db->sql_query($sql);
}
@@ -372,14 +395,51 @@ switch($mode)
{
if(isset($HTTP_POST_VARS['delete_post']))
{
-
-
+
+
}
else
{
-
-
-
+ $post_id = $HTTP_POST_VARS[POST_POST_URL];
+ $new_topic_id = $HTTP_POST_VARS[POST_TOPIC_URL];
+
+ $sql = "UPDATE ".POSTS_TEXT_TABLE." SET post_text = '$message', post_subject = '$subject' WHERE post_id = ".$HTTP_POST_VARS[POST_POST_URL];
+ if($db->sql_query($sql))
+ {
+ if($is_first_post)
+ {
+ // Update topics table here, set notification level and such
+ }
+ else
+ {
+ include('includes/page_header.'.$phpEx);
+ // If we get here the post has been inserted successfully.
+ $msg = "$l_stored
$l_click $l_here
+ $l_viewmsg
$l_click $l_here $l_returntopic";
+
+ $template->set_filenames(array(
+ "reg_header" => "error_body.tpl"
+ ));
+ $template->assign_vars(array(
+ "ERROR_MESSAGE" => $msg
+ ));
+ $template->pparse("reg_header");
+
+ include('includes/page_tail.'.$phpEx);
+ }
+ }
+ else
+ {
+ if(DEBUG)
+ {
+ $error = $db->sql_error();
+ error_die(QUERY_ERROR, "Error updateing posts text table.
Reason: ".$error['message']."
Query: $sql", __LINE__, __FILE__);
+ }
+ else
+ {
+ error_die(QUERY_ERROR);
+ }
+ }
}
}
else
@@ -388,37 +448,42 @@ switch($mode)
if(!empty($post_id))
{
- $sql = "SELECT p.*, pt.post_text, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_notify
- FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TEXT_TABLE." pt
- WHERE (p.post_id = '$post_id')
+ $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_notify
+ FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TEXT_TABLE." pt
+ WHERE (p.post_id = '$post_id')
AND pt.post_id = p.post_id
- AND (p.topic_id = t.topic_id)
+ AND (p.topic_id = t.topic_id)
AND (p.poster_id = u.user_id)";
-
+
if($result = $db->sql_query($sql))
{
$postrow = $db->sql_fetchrowset($result);
+ $subject = stripslashes($postrow[0]['post_subject']);
$message = stripslashes($postrow[0]['post_text']);
- $message = eregi_replace("\[addsig]$", "\n_________________\n" . stripslashes($postrow[0]['user_sig']), $message);
+ if(eregi("\[addsig]$", $message))
+ {
+ $attach_sig = TRUE;
+ }
+ $message = eregi_replace("\[addsig]$", "", $message);
$message = str_replace("
", "\n", $message);
-
+
// These have not been implemented yet!
/*
$message = bbdecode($message);
$message = desmile($message);
*/
-
+
$message = undo_htmlspecialchars($message);
-
+
// Special handling for tags in the message, which can break the editing form..
$message = preg_replace('##si', '</TEXTAREA>', $message);
-
+
// is_first_post needs functionality!
if($postrow[0]['topic_notify'] && $is_first_post)
{
$notify = TRUE;
}
-
+
if($is_first_post)
{
$subject = stripslashes($postrow[0]['topic_title']);
@@ -476,7 +541,7 @@ if($error)
error_die(GENERAL_ERROR, "Sorry, no there is no such forum");
}
-
+
$sql = "SELECT forum_name, forum_access
FROM ".FORUMS_TABLE."
WHERE forum_id = $forum_id";
@@ -511,7 +576,7 @@ if($error)
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
-
+
$template->assign_vars(array(
"L_POSTNEWIN" => $section_title,
@@ -574,16 +639,13 @@ if($error)
}
$smile_toggle .= "> $l_disable $l_smilies $l_onthispost";
- if($mode != 'editpost')
+ $sig_toggle = '";
+ $hidden_form_fields = "";
$template->assign_vars(array(
"L_ABOUT_POST" => $l_aboutpost,
diff --git a/phpBB/templates/Default/viewtopic_body.tpl b/phpBB/templates/Default/viewtopic_body.tpl
index a4739c459c..192cce7a6b 100644
--- a/phpBB/templates/Default/viewtopic_body.tpl
+++ b/phpBB/templates/Default/viewtopic_body.tpl
@@ -4,17 +4,17 @@
+ |
+
@@ -52,18 +52,18 @@
-
+
-
+
-
-
+ |
+
- |
+ {JUMPBOX} |
+
+
+ |
-
+
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 3818e2d6b0..23c6e7a1a4 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -201,7 +201,7 @@ if(!isset($start))
$start = 0;
}
-$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, p.post_time, p.post_id, p.bbcode_uid, pt.post_text
+$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, p.post_time, p.post_id, p.bbcode_uid, pt.post_text, pt.post_subject
FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
@@ -321,6 +321,7 @@ for($x = 0; $x < $total_posts; $x++)
$delpost_img = "
";
}
+ $post_subject = stripslashes($postrow[$x]['post_subject']);
$message = stripslashes($postrow[$x]['post_text']);
$bbcode_uid = $postrow[$x]['bbcode_uid'];
$user_sig = stripslashes($postrow[$x]['user_sig']);
@@ -365,6 +366,7 @@ for($x = 0; $x < $total_posts; $x++)
"POSTER_POSTS" => $poster_posts,
"POSTER_FROM" => $poster_from,
"POST_DATE" => $post_date,
+ "POST_SUBJECT" => $post_subject,
"MESSAGE" => $message,
"PROFILE_IMG" => $profile_img,
"EMAIL_IMG" => $email_img,