From dc2cd415d327c50b28182ca76c1ca2956e70a771 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 16 Jun 2001 14:29:49 +0000 Subject: Fixed error in return to post link when editing a message git-svn-id: file:///svn/phpbb/trunk@502 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/posting.php | 103 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 49 deletions(-) (limited to 'phpBB') diff --git a/phpBB/posting.php b/phpBB/posting.php index c224668d4e..84094e8b9b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -6,7 +6,11 @@ * copyright : (C) 2001 The phpBB Group * email : support@phpbb.com * +<<<<<<< posting.php * $Id$ +======= + * $Id$ +>>>>>>> 1.35 * * ***************************************************************************/ @@ -663,8 +667,10 @@ switch($mode) break; case 'editpost': + $page_title = " $l_editpost"; $section_title = $l_editpostin; + if(isset($HTTP_POST_VARS['submit']) && !$error && !$preview) { if(isset($HTTP_POST_VARS['delete_post'])) @@ -690,13 +696,13 @@ switch($mode) } } - $sql = "UPDATE ".POSTS_TEXT_TABLE." SET post_text = '$message', post_subject = '$subject' WHERE post_id = ".$HTTP_POST_VARS[POST_POST_URL]; + $sql = "UPDATE ".POSTS_TEXT_TABLE." SET post_text = '$message', post_subject = '$subject' WHERE post_id = $post_id"; 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', topic_type = '".$topic_type."' WHERE topic_id = ".$HTTP_POST_VARS[POST_TOPIC_URL]; + $sql = "UPDATE ".TOPICS_TABLE." SET topic_title = '$subject', topic_notify = '$notify', topic_type = '".$topic_type."' WHERE topic_id = $new_topic_id"; if(!$db->sql_query($sql)) { if(SQL_LAYER != "mysql") @@ -746,7 +752,7 @@ switch($mode) // include('includes/page_header.'.$phpEx); - $msg = $lang['Stored'] . "

" . $lang['Click'] . " " . $lang['Here'] . " " . $lang['to_view_message'] . "

" . $lang['Click'] . " " . $lang['Here'] . " ". $lang['to_return_forum']; + $msg = $lang['Stored'] . "

" . $lang['Click'] . " " . $lang['Here'] . " " . $lang['to_view_message'] . "

" . $lang['Click'] . " " . $lang['Here'] . " ". $lang['to_return_forum']; $template->set_filenames(array( "reg_header" => "error_body.tpl" @@ -783,7 +789,7 @@ switch($mode) // include('includes/page_header.'.$phpEx); - $msg = $lang['Stored'] . "

" . $lang['Click'] . " " . $lang['Here'] . " " . $lang['to_view_message'] . "

" . $lang['Click'] . " " . $lang['Here'] . " ". $lang['to_return_forum']; + $msg = $lang['Stored'] . "

" . $lang['Click'] . " " . $lang['Here'] . " " . $lang['to_view_message'] . "

" . $lang['Click'] . " " . $lang['Here'] . " ". $lang['to_return_forum']; $template->set_filenames(array( "reg_header" => "error_body.tpl" @@ -813,15 +819,16 @@ switch($mode) else if(!$preview) { $post_id = ($HTTP_GET_VARS[POST_POST_URL]) ? $HTTP_GET_VARS[POST_POST_URL] : $HTTP_POST_VARS[POST_POST_URL]; + if(!empty($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, t.topic_type - 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.poster_id = u.user_id)"; + $sql = "SELECT p.*, pt.post_text, pt.post_subject, u.username, u.user_id, u.user_sig, t.topic_title, t.topic_notify, t.topic_type + 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.poster_id = u.user_id)"; if($result = $db->sql_query($sql)) { @@ -851,60 +858,58 @@ switch($mode) $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); - */ + // Removes UID from BBEncoded entries + $message = preg_replace("/\:[0-9a-z\:]*?\]/si", "]", $message); - $message = undo_htmlspecialchars($message); + // This has not been implemented yet! + //$message = desmile($message); - // Special handling for tags in the message, which can break the editing form.. - $message = preg_replace('##si', '</TEXTAREA>', $message); + $message = str_replace("
", "\n", $message); + + $message = undo_htmlspecialchars($message); + + // Special handling for tags in the message, which can break the editing form.. + $message = preg_replace('##si', '</TEXTAREA>', $message); - if($is_first_post) - { - $notify_show = TRUE; - if($postrow['topic_notify']) + if($is_first_post) { - $notify = TRUE; - } + $notify_show = TRUE; + if($postrow['topic_notify']) + { + $notify = TRUE; + } $subject = stripslashes($postrow['topic_title']); switch($postrow['topic_type']) { case ANNOUCE: $is_annouce = TRUE; - break; + break; case STICKY: $is_stuck = TRUE; - break; + break; } - } - - - } - else - { - if(DEBUG) - { - $error = $db->error(); - error_die(QUERY_ERROR, "Error get post information.
Reason: ".$error['message']."
Query: $sql", __LINE__, __FILE__); - } - else - { - error_die(QUERY_ERROR); - } - } - } - else - { - error_die(GENERAL_ERROR, "Sorry, no there is no such post"); - } + } + else + { + if(DEBUG) + { + $error = $db->error(); + error_die(QUERY_ERROR, "Error get post information.
Reason: ".$error['message']."
Query: $sql", __LINE__, __FILE__); + } + else + { + error_die(QUERY_ERROR); + } + } + } + else + { + error_die(GENERAL_ERROR, "Sorry, no there is no such post"); + } } - break; + break; } // end switch // -- cgit v1.2.1