From e5211f3d205f08a485f0e5bb828667bbc7876678 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 15 Jul 2001 15:45:09 +0000 Subject: [PATCH] Added editing information, no time limit at present git-svn-id: file:///svn/phpbb/trunk@673 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/db/mysql_schema.sql | 2 ++ phpBB/db/postgres_schema.sql | 4 +++- phpBB/language/lang_english.php | 5 +++++ phpBB/posting.php | 27 +++++++++++++++++++++++---- phpBB/viewtopic.php | 32 ++++++++++++++++++++++++-------- 5 files changed, 57 insertions(+), 13 deletions(-) diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql index d475bdd816..fd25d3cebb 100644 --- a/phpBB/db/mysql_schema.sql +++ b/phpBB/db/mysql_schema.sql @@ -204,6 +204,8 @@ CREATE TABLE phpbb_posts ( poster_ip char(8) NOT NULL, post_username varchar(30), bbcode_uid varchar(10) NOT NULL, + post_edit_time int(11), + post_edit_count smallint(4) DEFAULT '0' NOT NULL, PRIMARY KEY (post_id), KEY forum_id (forum_id), KEY topic_id (topic_id), diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql index bad7d810a8..c7427531d1 100644 --- a/phpBB/db/postgres_schema.sql +++ b/phpBB/db/postgres_schema.sql @@ -199,7 +199,9 @@ CREATE TABLE phpbb_posts ( post_time int4 DEFAULT '0' NOT NULL, post_username varchar(30), poster_ip char(8) DEFAULT '' NOT NULL, - bbcode_uid varchar(10) DEFAULT '' NOT NULL, + bbcode_uid varchar(10) DEFAULT '' NOT NULL, + post_edit_time int4, + post_edit_count int2 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_posts_pkey PRIMARY KEY (post_id) ); CREATE INDEX forum_id_phpbb_posts_index ON phpbb_posts (forum_id); diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 7ec7af7236..2811b1ba3e 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -199,6 +199,11 @@ $lang['Reply_with_quote'] = "Reply with quote"; $lang['View_IP'] = "View IP of poster"; $lang['Delete_post'] = "Delete this post"; +$lang['Edited_by'] = "Last edited by"; // followed by -> [username] on ... +$lang['on'] = "on"; +$lang['edited'] = "edited"; // followed by -> [num] times in total +$lang['times_in_total'] = "time/s in total"; + $lang['Lock_topic'] = "Lock this topic"; $lang['Unlock_topic'] = "Unlock this topic"; $lang['Move_topic'] = "Move this topic"; diff --git a/phpBB/posting.php b/phpBB/posting.php index 10050144c9..525de75679 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -164,6 +164,7 @@ if( $mode != "newtopic" ) { $topic_id = $check_row['topic_id']; } + $is_first_post = FALSE; $is_last_post = FALSE; } @@ -357,7 +358,7 @@ if( ( isset($HTTP_POST_VARS['submit']) || $preview ) && $topic_status == TOPIC_U $message = prepare_message(stripslashes($HTTP_POST_VARS['message']), $html_on, $bbcode_on, $smile_on, $bbcode_uid); - if($attach_sig && !empty($userdata['user_sig'])) + if( $attach_sig ) { $message .= (eregi(" $", $message)) ? "[addsig]" : " [addsig]"; } @@ -776,8 +777,17 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) } else { + if( !$is_last_post && $userdata['user_level'] != ADMIN ) + { + $edited_sql = ", post_edit_time = " . time() . ", post_edit_count = post_edit_count + 1 "; + } + else + { + $edited_sql = ""; + } + $sql = "UPDATE " . POSTS_TABLE . " - SET bbcode_uid = '$bbcode_uid' + SET bbcode_uid = '$bbcode_uid'" . $edited_sql . " WHERE post_id = $post_id"; if($db->sql_query($sql, BEGIN_TRANSACTION)) @@ -866,11 +876,16 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) $subject = stripslashes(trim($postrow['post_subject'])); $message = stripslashes(trim($postrow['post_text'])); + if(eregi("\[addsig]$", $message)) { + $message = eregi_replace("\[addsig]$", "", $message); $attach_sig = TRUE; } - $message = eregi_replace("\[addsig]$", "", $message); + else + { + $attach_sig = FALSE; + } // Removes UID from BBCode entries $message = preg_replace("/\:[0-9a-z\:]*?\]/si", "]", $message); @@ -899,6 +914,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED ) case POST_ANNOUNCE: $is_announce = TRUE; break; + case POST_STICKY: $is_sticky = TRUE; break; @@ -950,6 +966,7 @@ if($preview && !$error) case POST_ANNOUNCE: $is_announce = TRUE; break; + case POST_STICKY: $is_sticky = TRUE; break; @@ -961,7 +978,9 @@ if($preview && !$error) $preview_message = bbencode_second_pass($preview_message, $bbcode_uid); $preview_message = make_clickable($preview_message); - $template->set_filenames(array("preview" => "posting_preview.tpl")); + $template->set_filenames(array( + "preview" => "posting_preview.tpl") + ); $template->assign_vars(array( "TOPIC_TITLE" => $subject, "POST_SUBJECT" => $subject, diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 68583b57c3..ee1b0acaff 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -166,7 +166,7 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_view']) // // Go ahead and pull all data for this topic // -$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, u.user_avatar, p.post_time, p.post_id, p.bbcode_uid, pt.post_text, pt.post_subject, p.post_username +$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, u.user_avatar, p.post_time, p.post_id, p.post_username, p.bbcode_uid, p.post_edit_time, p.post_edit_count, pt.post_text, pt.post_subject FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt WHERE p.topic_id = $topic_id AND p.poster_id = u.user_id @@ -394,16 +394,21 @@ for($i = 0; $i < $total_posts; $i++) if(!$board_config['allow_html']) { - $user_sig = strip_tags($user_sig); + if($user_sig != "") + { + $user_sig = strip_tags($user_sig); + } $message = strip_tags($message); } if($board_config['allow_bbcode']) { - // do bbcode stuff here - $sig_uid = make_bbcode_uid(); - $user_sig = bbencode_first_pass($user_sig, $sig_uid); - $user_sig = bbencode_second_pass($user_sig, $sig_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); + } $message = bbencode_second_pass($message, $bbcode_uid); } @@ -411,6 +416,19 @@ for($i = 0; $i < $total_posts; $i++) $message = make_clickable($message); $message = str_replace("\n", "
", $message); + if($user_sig != "") + { + $message = eregi_replace("\[addsig]$", "

_________________
" . nl2br($user_sig), $message); + } + + // + // Editing information + // + if($postrow[$i]['post_edit_count']) + { + $message = $message . "

" . $lang['Edited_by'] . " " . $poster . " " . $lang['on'] . " " . create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['default_timezone']) . ", " . $lang['edited'] . " " . $postrow[$i]['post_edit_count'] . " " . $lang['times_in_total'] . ""; + } + // // Again this will be handled by the templating // code at some point @@ -424,8 +442,6 @@ for($i = 0; $i < $total_posts; $i++) $color = "#" . $theme['td_color2']; } - $message = eregi_replace("\[addsig]$", "

_________________
" . nl2br($user_sig), $message); - $template->assign_block_vars("postrow", array( "POSTER_NAME" => $poster, "POSTER_RANK" => $poster_rank,