Users sigs display correctly.

Some minor improvments to posting...still LOTS to be done


git-svn-id: file:///svn/phpbb/trunk@326 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-05-25 07:02:48 +00:00
parent cbed447842
commit 7ab6eaf3de
2 changed files with 40 additions and 32 deletions

View file

@ -54,26 +54,26 @@ init_userprefs($userdata);
function prepare_message($message, $html_on, $bbocde_on, $smile_on, $bbcode_uid = 0) function prepare_message($message, $html_on, $bbocde_on, $smile_on, $bbcode_uid = 0)
{ {
$message = trim($message); $message = trim($message);
if(!$html_on) if(!$html_on)
{ {
$message = htmlspecialchars($message); $message = htmlspecialchars($message);
} }
if($bbocde_on) if($bbocde_on)
{ {
$message = bbencode_first_pass($message, $bbcode_uid); $message = bbencode_first_pass($message, $bbcode_uid);
} }
if($smile_on) if($smile_on)
{ {
// No smile() function yet, write one... // No smile() function yet, write one...
//$message = smile($message); //$message = smile($message);
} }
$message = addslashes($message); $message = addslashes($message);
return($message); return($message);
} }
// //
@ -99,7 +99,7 @@ switch($mode)
{ {
$html_on = TRUE; $html_on = TRUE;
} }
if(isset($HTTP_POST_VARS['disable_bbcode']) || !$board_config['allow_bbcode']) if(isset($HTTP_POST_VARS['disable_bbcode']) || !$board_config['allow_bbcode'])
{ {
$bbcode_on = FALSE; $bbcode_on = FALSE;
@ -109,7 +109,7 @@ switch($mode)
$uid = make_bbcode_uid(); $uid = make_bbcode_uid();
$bbocde_on = TRUE; $bbocde_on = TRUE;
} }
if(isset($HTTP_POST_VARS['disable_smile'])) if(isset($HTTP_POST_VARS['disable_smile']))
{ {
$smile_on = FALSE; $smile_on = FALSE;
@ -118,25 +118,25 @@ switch($mode)
{ {
$smile_on = TRUE; $smile_on = TRUE;
} }
$message = prepare_message($HTTP_POST_VARS['message'], $html_on, $bbocde_on, $smile_on, $uid); $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'])) if(isset($HTTP_POST_VARS['attach_sig']) && !empty($userdata['user_sig']))
{ {
$message .= "[addsig]"; $message .= "[addsig]";
} }
$subject = trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['subject']))); $subject = trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['subject'])));
$topic_time = gmmktime(date("h, i, s, m, d, Y")); $topic_time = gmmktime(gmdate("h, i, s, m, d, Y"));
$topic_notify = ($HTTP_POST_VARS['notify']) ? $HTTP_POST_VARS['notify'] : 0; $topic_notify = ($HTTP_POST_VARS['notify']) ? $HTTP_POST_VARS['notify'] : 0;
$sql = "INSERT INTO ".TOPICS_TABLE." (topic_title, topic_poster, topic_time, forum_id, topic_notify, topic_status) $sql = "INSERT INTO ".TOPICS_TABLE." (topic_title, topic_poster, topic_time, forum_id, topic_notify, topic_status)
VALUES ('$subject', ".$userdata['user_id'].", ".$topic_time.", $forum_id, $topic_notify, ".UNLOCKED.")"; VALUES ('$subject', ".$userdata['user_id'].", ".$topic_time.", $forum_id, $topic_notify, ".UNLOCKED.")";
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$new_topic_id = $db->sql_nextid(); $new_topic_id = $db->sql_nextid();
$sql = "INSERT INTO ".POSTS_TABLE." (topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid) $sql = "INSERT INTO ".POSTS_TABLE." (topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid)
VALUES ($new_topic_id, $forum_id, ".$userdata['user_id'].", $topic_time, '".encode_ip($user_ip)."', '$uid')"; VALUES ($new_topic_id, $forum_id, ".$userdata['user_id'].", $topic_time, '".encode_ip($user_ip)."', '$uid')";
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
$new_post_id = $db->sql_nextid(); $new_post_id = $db->sql_nextid();
@ -151,7 +151,7 @@ switch($mode)
{ {
include('includes/page_header.'.$phpEx); include('includes/page_header.'.$phpEx);
// If we get here the post has been inserted successfully. // If we get here the post has been inserted successfully.
$msg = "$l_stored<br />$l_click <a href=\"".append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id")."\">$l_here</a> $msg = "$l_stored<br />$l_click <a href=\"".append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=$new_topic_id")."\">$l_here</a>
$l_viewmsg<br />$l_click <a href=\"".append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id")."\">$l_here</a> $l_returntopic"; $l_viewmsg<br />$l_click <a href=\"".append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id")."\">$l_here</a> $l_returntopic";
$template->set_filenames(array( $template->set_filenames(array(
@ -161,8 +161,8 @@ switch($mode)
"ERROR_MESSAGE" => $msg "ERROR_MESSAGE" => $msg
)); ));
$template->pparse("reg_header"); $template->pparse("reg_header");
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);
} }
else else
{ {
@ -207,7 +207,7 @@ switch($mode)
error_die(QUERY_ERROR); error_die(QUERY_ERROR);
} }
} }
} }
else else
{ {
if(DEBUG) if(DEBUG)
@ -219,15 +219,15 @@ switch($mode)
{ {
error_die(QUERY_ERROR); error_die(QUERY_ERROR);
} }
} }
} }
else if(isset($HTTP_POST_VARS['preview'])) else if(isset($HTTP_POST_VARS['preview']))
{ {
} }
if(!isset($HTTP_GET_VARS[POST_FORUM_URL]) && !isset($HTTP_POST_VARS[POST_FORUM_URL])) if(!isset($HTTP_GET_VARS[POST_FORUM_URL]) && !isset($HTTP_POST_VARS[POST_FORUM_URL]))
{ {
@ -236,9 +236,9 @@ switch($mode)
$pagetype = "newtopic"; $pagetype = "newtopic";
$page_title = " $l_postnew"; $page_title = " $l_postnew";
$sql = "SELECT forum_name, forum_access $sql = "SELECT forum_name, forum_access
FROM ".FORUMS_TABLE." FROM ".FORUMS_TABLE."
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
@ -277,7 +277,7 @@ switch($mode)
"L_POSTNEWIN" => $l_postnewin, "L_POSTNEWIN" => $l_postnewin,
"FORUM_ID" => $forum_id, "FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name, "FORUM_NAME" => $forum_name,
"U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id")) "U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id"))
); );
@ -370,7 +370,7 @@ switch($mode)
"NOTIFY_TOGGLE" => $notify_toggle, "NOTIFY_TOGGLE" => $notify_toggle,
"BBCODE_TOGGLE" => $bbcode_toggle, "BBCODE_TOGGLE" => $bbcode_toggle,
"BBCODE_STATUS" => $bbcode_status, "BBCODE_STATUS" => $bbcode_status,
"S_POST_ACTION" => append_sid("posting.$phpEx"), "S_POST_ACTION" => append_sid("posting.$phpEx"),
"S_HIDDEN_FORM_FIELDS" => $hidden_form_fields) "S_HIDDEN_FORM_FIELDS" => $hidden_form_fields)
); );

View file

@ -67,7 +67,7 @@ if(isset($HTTP_GET_VARS['view']))
f.forum_type, f.forum_name, f.forum_id, u.username, u.user_id f.forum_type, f.forum_name, f.forum_id, u.username, u.user_id
FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u
WHERE t.topic_id in WHERE t.topic_id in
(select min(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id)) (select max(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id))
AND f.forum_id = ".$HTTP_GET_VARS[POST_FORUM_URL]." AND f.forum_id = ".$HTTP_GET_VARS[POST_FORUM_URL]."
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id AND fm.forum_id = t.forum_id
@ -138,7 +138,15 @@ if(!$total_rows = $db->sql_numrows($result))
} }
else else
{ {
error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again."); if(DEBUG)
{
$error = $db->sql_error();
error_die(GENERAL_ERROR, "The forum/topic you selected does not exist.<br>Reason: ".$error['message']."<br>Query: $sql", __LINE__, __FILE__);
}
else
{
error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
}
} }
} }
$forum_row = $db->sql_fetchrowset($result); $forum_row = $db->sql_fetchrowset($result);
@ -184,7 +192,7 @@ if(!isset($start))
$start = 0; $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, 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
FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt
WHERE p.topic_id = $topic_id WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id AND p.poster_id = u.user_id
@ -392,7 +400,7 @@ flush();
// right away and dosan't have to wait for this update query to finish. // right away and dosan't have to wait for this update query to finish.
// //
$sql = "UPDATE ".TOPICS_TABLE." SET topic_views = topic_views + 1 WHERE topic_id = $topic_id"; $sql = "UPDATE ".TOPICS_TABLE." SET topic_views = topic_views + 1 WHERE topic_id = $topic_id";
// We don't care too much if this query succeeds or not so I'm not going to bother checking // We don't care too much if this query succeeds or not so I'm not going to bother checking
$db->sql_query($sql); $db->sql_query($sql);
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);