Only give sig option if user has a signature, display correct signature when editing, do user_id check for edit preview

git-svn-id: file:///svn/phpbb/trunk@837 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-08-10 23:13:41 +00:00
parent 9899e2b975
commit 64c167edf4

View file

@ -955,7 +955,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
header("Location: viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"); header("Location: viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
} }
else if(!$preview) else
{ {
if( !empty($post_id) ) if( !empty($post_id) )
{ {
@ -975,13 +975,17 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
message_die(GENERAL_MESSAGE, $lang['Sorry_edit_own_posts']); message_die(GENERAL_MESSAGE, $lang['Sorry_edit_own_posts']);
} }
if(!$preview)
{
$subject = stripslashes(trim($postrow['post_subject'])); $subject = stripslashes(trim($postrow['post_subject']));
$message = stripslashes(trim($postrow['post_text'])); $message = stripslashes(trim($postrow['post_text']));
if(eregi("\[addsig]$", $message)) if(eregi("\[addsig]$", $message))
{ {
$message = eregi_replace("\[addsig]$", "", $message); $message = eregi_replace("\[addsig]$", "", $message);
$attach_sig = TRUE;
$user_sig = ($postrow['user_sig'] != "") ? $postrow['user_sig'] : "";
$attach_sig = ($postrow['user_sig'] != "") ? TRUE : 0;
} }
else else
{ {
@ -1020,6 +1024,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
} }
} }
} }
}
else else
{ {
message_die(GENERAL_MESSAGE, $lang['No_such_post']); message_die(GENERAL_MESSAGE, $lang['No_such_post']);
@ -1068,6 +1073,20 @@ if(empty($username))
$username = stripslashes($userdata['username']); $username = stripslashes($userdata['username']);
} }
//
// Define a signature, this is in practice only used for
// preview but doing this here allows us to use it as a
// check for attach_sig later
//
if( $mode == "editpost" )
{
$user_sig = ($postrow['user_sig'] != "") ? $postrow['user_sig'] : "";
}
else
{
$user_sig = ($userdata['user_sig'] != "") ? $userdata['user_sig'] : "";
}
// //
// Start: Preview Post // Start: Preview Post
// //
@ -1094,8 +1113,6 @@ if($preview && !$error)
// //
// Finalise processing as per viewtopic // Finalise processing as per viewtopic
// //
$user_sig = ($userdata['user_sig'] != "") ? $userdata['user_sig'] : "";
if( !$html_on ) if( !$html_on )
{ {
if($user_sig != "") if($user_sig != "")
@ -1105,10 +1122,6 @@ if($preview && !$error)
$preview_message = htmlspecialchars($preview_message); $preview_message = htmlspecialchars($preview_message);
} }
if($bbcode_on)
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
if($user_sig != "") if($user_sig != "")
{ {
$sig_uid = make_bbcode_uid(); $sig_uid = make_bbcode_uid();
@ -1116,6 +1129,10 @@ if($preview && !$error)
$user_sig = bbencode_second_pass($user_sig, $sig_uid); $user_sig = bbencode_second_pass($user_sig, $sig_uid);
} }
if($bbcode_on)
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
// //
// This compensates for bbcode's rather agressive (but I guess necessary) // This compensates for bbcode's rather agressive (but I guess necessary)
// HTML handling // HTML handling
@ -1253,9 +1270,10 @@ else
} }
// //
// Signature toggle selection // Signature toggle selection - only show if
// the user has a signature
// //
if($attach_sig) if( $user_sig != "" )
{ {
$template->assign_block_vars("signature_checkbox", array()); $template->assign_block_vars("signature_checkbox", array());
} }