diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php
index 8ce39b8fbc..15ad56063d 100755
--- a/phpBB/language/lang_english.php
+++ b/phpBB/language/lang_english.php
@@ -150,6 +150,8 @@ $lang['Post_Annoucement'] = "Post as an annoucement";
$lang['Post_Sticky'] = "Stick this topic";
$lang['Annouce_and_sticky'] = "You cannot post a topic that is both an annoucement and a sticky topic";
$lang['Preview'] = "Preview";
+$lang['Post_a'] = "Post a";
+$lang['Edit_Post'] = "Edit Post";
//
// Private Messaging
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 9fb33b73cc..39b0c9ee19 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -163,6 +163,7 @@ $error = FALSE;
//
// Set initial conditions
//
+$is_first_post = (($HTTP_GET_VARS['is_first_post'] == 1) || ($HTTP_POST_VARS['is_first_post'] == 1)) ? TRUE : FALSE;
$disable_html = (isset($HTTP_POST_VARS['disable_html'])) ? $HTTP_POST_VARS['disable_html'] : !$userdata['user_allowhtml'];
$disable_bbcode = (isset($HTTP_POST_VARS['disable_bbcode'])) ? $HTTP_POST_VARS['disable_bbcode'] : !$userdata['user_allowbbcode'];
$disable_smilies = (isset($HTTP_POST_VARS['disable_smile'])) ? $HTTP_POST_VARS['disable_smile'] : !$userdata['user_allowsmile'];
@@ -551,8 +552,8 @@ switch($mode)
$new_topic_id = $HTTP_POST_VARS[POST_TOPIC_URL];
$topic_time = get_gmt_ts();
- $sql = "INSERT INTO ".POSTS_TABLE." (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid)
- VALUES ($new_topic_id, $forum_id, ".$userdata['user_id'].", '".$username."', $topic_time, '$user_ip', '$uid')";
+ $sql = "INSERT INTO ".POSTS_TABLE." (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid)
+ VALUES ($new_topic_id, $forum_id, ".$userdata['user_id'].", '".$username."', $topic_time, '$user_ip', '$uid')";
if($db->sql_query($sql))
{
@@ -713,16 +714,106 @@ switch($mode)
{
$post_id = $HTTP_POST_VARS[POST_POST_URL];
$new_topic_id = $HTTP_POST_VARS[POST_TOPIC_URL];
-
+
+ if($SQL_LAYER != "mysql")
+ {
+ switch($SQL_LAYER)
+ {
+ case 'postgres':
+ $result = $db->sql_query("BEGIN");
+ break;
+ case 'mssql':
+ $result = $db->sql_query("BEGIN TRANSACTION");
+ break;
+ }
+ }
+
$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
+ $sql = "UPDATE ".TOPICS_TABLE." SET topic_title = '$subject', topic_notify = '$notify' WHERE topic_id = ".$HTTP_POST_VARS[POST_TOPIC_URL];
+ if(!$db->sql_query($sql))
+ {
+ if(SQL_LAYER != "mysql")
+ {
+ switch($SQL_LAYER)
+ {
+ case 'postgres':
+ $result = $db->sql_query("ROLLBACK");
+ break;
+ case 'mssql':
+ $result = $db->sql_query("ROLLBACK TRANSACTION");
+ break;
+ }
+ }
+
+ if(DEBUG)
+ {
+ $error = $db->sql_error();
+ error_die(QUERY_ERROR, "Updating topics table.
Reason: ".$error['message']."
Query: $sql", __LINE__, __FILE__);
+ }
+ else
+ {
+ error_die(QUERY_ERROR);
+ }
+ }
+ else
+ {
+ if(SQL_LAYER != "mysql")
+ {
+ switch($SQL_LAYER)
+ {
+ case 'postgres':
+ $result = $db->sql_query("COMMIT");
+ break;
+ case 'mssql':
+ $result = $db->sql_query("COMMIT TRANSACTION");
+ break;
+ }
+ if(!$result)
+ {
+ error_die(SQL_ERROR, "Couldn't commit");
+ }
+ }
+
+ 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(SQL_LAYER != "mysql")
+ {
+ switch($SQL_LAYER)
+ {
+ case 'postgres':
+ $result = $db->sql_query("COMMIT");
+ break;
+ case 'mssql':
+ $result = $db->sql_query("COMMIT TRANSACTION");
+ break;
+ }
+ if(!$result)
+ {
+ error_die(SQL_ERROR, "Couldn't commit");
+ }
+ }
+
include('includes/page_header.'.$phpEx);
// If we get here the post has been inserted successfully.
$msg = "$l_stored
$l_click $l_here
@@ -898,10 +989,11 @@ if($preview)
//
// Show the same form for each mode.
//
- if(!isset($HTTP_GET_VARS[POST_FORUM_URL]) && !isset($HTTP_POST_VARS[POST_FORUM_URL]))
- {
- error_die(GENERAL_ERROR, "Sorry, no there is no such forum");
- }
+
+if(!isset($HTTP_GET_VARS[POST_FORUM_URL]) && !isset($HTTP_POST_VARS[POST_FORUM_URL]))
+{
+ error_die(GENERAL_ERROR, "Sorry, no there is no such forum");
+}
$sql = "SELECT forum_name
FROM ".FORUMS_TABLE."
@@ -1033,8 +1125,21 @@ if($preview)
$topic_id = ($HTTP_GET_VARS[POST_TOPIC_URL]) ? $HTTP_GET_VARS[POST_TOPIC_URL] : $HTTP_POST_VARS[POST_TOPIC_URL];
$post_id = ($HTTP_GET_VARS[POST_POST_URL]) ? $HTTP_GET_VARS[POST_POST_URL] : $HTTP_POST_VARS[POST_POST_URL];
}
- $hidden_form_fields = "";
+ $hidden_form_fields = "";
+ if($mode == 'newtopic')
+ {
+ $post_a = $lang['Post_a'] . " " . $lang['Topic'];
+ }
+ else if($mode == 'reply')
+ {
+ $post_a = $lang['Post_a'] . " " . $lang['Reply'];
+ }
+ else if($mode == 'editpost')
+ {
+ $post_a = $lang['Edit_Post'];
+ }
+
$template->assign_vars(array(
"L_SUBJECT" => $l_subject,
"L_MESSAGE_BODY" => $l_body,
@@ -1042,7 +1147,7 @@ if($preview)
"L_PREVIEW" => $lang['Preview'],
"L_SUBMIT" => $l_submit,
"L_CANCEL" => $l_cancelpost,
-
+ "L_POST_A" => $post_a,
"USERNAME_INPUT" => $username_input,
"PASSWORD_INPUT" => $password_input,
"SUBJECT_INPUT" => $subject_input,
diff --git a/phpBB/templates/Default/posting_body.tpl b/phpBB/templates/Default/posting_body.tpl
index 6afc43cea7..5ea22d30b5 100644
--- a/phpBB/templates/Default/posting_body.tpl
+++ b/phpBB/templates/Default/posting_body.tpl
@@ -34,6 +34,9 @@ function addBBcode(bbCode)
{L_POST_A} | +|
{L_USERNAME} | {USERNAME_INPUT} | diff --git a/phpBB/templates/PSO/posting_body.tpl b/phpBB/templates/PSO/posting_body.tpl index 3c3c655eab..6eb2b0f22f 100644 --- a/phpBB/templates/PSO/posting_body.tpl +++ b/phpBB/templates/PSO/posting_body.tpl @@ -17,7 +17,7 @@ function insertCode(formObj, selectObj){