aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/posting.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-08-10 23:13:41 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-08-10 23:13:41 +0000
commit64c167edf4b469a48317f5d3f71218b0e81d36c2 (patch)
tree53b7be922eaf29f9e15802ede662109cf87fcc42 /phpBB/posting.php
parent9899e2b975e13d512cfc9e5d8ac25617130150b7 (diff)
downloadforums-64c167edf4b469a48317f5d3f71218b0e81d36c2.tar
forums-64c167edf4b469a48317f5d3f71218b0e81d36c2.tar.gz
forums-64c167edf4b469a48317f5d3f71218b0e81d36c2.tar.bz2
forums-64c167edf4b469a48317f5d3f71218b0e81d36c2.tar.xz
forums-64c167edf4b469a48317f5d3f71218b0e81d36c2.zip
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
Diffstat (limited to 'phpBB/posting.php')
-rw-r--r--phpBB/posting.php106
1 files changed, 62 insertions, 44 deletions
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 06f414b598..2eaa178f8f 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -955,7 +955,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
header("Location: viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
}
- else if(!$preview)
+ else
{
if( !empty($post_id) )
{
@@ -975,47 +975,52 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
message_die(GENERAL_MESSAGE, $lang['Sorry_edit_own_posts']);
}
- $subject = stripslashes(trim($postrow['post_subject']));
- $message = stripslashes(trim($postrow['post_text']));
-
- if(eregi("\[addsig]$", $message))
- {
- $message = eregi_replace("\[addsig]$", "", $message);
- $attach_sig = TRUE;
- }
- else
+ if(!$preview)
{
- $attach_sig = 0;
- }
+ $subject = stripslashes(trim($postrow['post_subject']));
+ $message = stripslashes(trim($postrow['post_text']));
+
+ if(eregi("\[addsig]$", $message))
+ {
+ $message = eregi_replace("\[addsig]$", "", $message);
+
+ $user_sig = ($postrow['user_sig'] != "") ? $postrow['user_sig'] : "";
+ $attach_sig = ($postrow['user_sig'] != "") ? TRUE : 0;
+ }
+ else
+ {
+ $attach_sig = 0;
+ }
- // Removes UID from BBCode entries
- $message = preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message);
+ // Removes UID from BBCode entries
+ $message = preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message);
- $message = str_replace("<br />", "\n", $message);
+ $message = str_replace("<br />", "\n", $message);
- $message = undo_htmlspecialchars($message);
+ $message = undo_htmlspecialchars($message);
- // Special handling for </textarea> tags in the message, which can break the editing form..
- $message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message);
+ // Special handling for </textarea> tags in the message, which can break the editing form..
+ $message = preg_replace('#</textarea>#si', '&lt;/TEXTAREA&gt;', $message);
- if($is_first_post)
- {
- $notify_show = TRUE;
- if($postrow['topic_notify'])
+ if($is_first_post)
{
- $notify = TRUE;
- }
- $subject = stripslashes($postrow['topic_title']);
+ $notify_show = TRUE;
+ if($postrow['topic_notify'])
+ {
+ $notify = TRUE;
+ }
+ $subject = stripslashes($postrow['topic_title']);
- switch($postrow['topic_type'])
- {
- case POST_ANNOUNCE:
- $is_announce = TRUE;
- break;
+ switch($postrow['topic_type'])
+ {
+ case POST_ANNOUNCE:
+ $is_announce = TRUE;
+ break;
- case POST_STICKY:
- $is_sticky = TRUE;
- break;
+ case POST_STICKY:
+ $is_sticky = TRUE;
+ break;
+ }
}
}
}
@@ -1069,6 +1074,20 @@ if(empty($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
//
if($preview && !$error)
@@ -1094,8 +1113,6 @@ if($preview && !$error)
//
// Finalise processing as per viewtopic
//
- $user_sig = ($userdata['user_sig'] != "") ? $userdata['user_sig'] : "";
-
if( !$html_on )
{
if($user_sig != "")
@@ -1105,17 +1122,17 @@ if($preview && !$error)
$preview_message = htmlspecialchars($preview_message);
}
+ if($user_sig != "")
+ {
+ $sig_uid = make_bbcode_uid();
+ $user_sig = bbencode_first_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);
- if($user_sig != "")
- {
- $sig_uid = make_bbcode_uid();
- $user_sig = bbencode_first_pass($user_sig, $sig_uid);
- $user_sig = bbencode_second_pass($user_sig, $sig_uid);
- }
-
//
// This compensates for bbcode's rather agressive (but I guess necessary)
// 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());
}