From c2da346e6581f4648ec7ad53bfa78a0de954d69a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 20 Apr 2003 16:49:26 +0000 Subject: [PATCH] #575496 - only one way to do it, user input would be nice. ;) git-svn-id: file:///svn/phpbb/trunk@3898 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_posting.php | 28 ++--- phpBB/language/en/lang_main.php | 2 + phpBB/posting.php | 120 +++++++++++++++----- phpBB/templates/subSilver/posting_body.html | 53 +++++++++ 4 files changed, 162 insertions(+), 41 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index fab7a2a701..389927983a 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -178,7 +178,7 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig) $message .= $user_sig; - return($message); + return $message; } // Update Last Post Informations @@ -569,7 +569,7 @@ function upload_attachment($filename) if (!$filedata['post_attach']) { - return ($filedata); + return $filedata; } $r_file = $filename; @@ -594,7 +594,7 @@ function upload_attachment($filename) $filedata['error'] = true; $filedata['err_msg'] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']); $filedata['post_attach'] = false; - return ($filedata); + return $filedata; } $allowed_filesize = ($extensions[$filedata['extension']]['max_filesize'] != 0) ? $extensions[$filedata['extension']]['max_filesize'] : $config['max_filesize']; @@ -606,7 +606,7 @@ function upload_attachment($filename) $filedata['error'] = true; $filedata['err_msg'] = sprintf($user->lang['INVALID_FILENAME'], $filename); $filedata['post_attach'] = false; - return ($filedata); + return $filedata; } // check php upload-size @@ -615,7 +615,7 @@ function upload_attachment($filename) $filedata['error'] = true; $filedata['err_msg'] = (@ini_get('upload_max_filesize') == '') ? $user->lang['ATTACHMENT_PHP_SIZE_NA'] : sprintf($user->lang['ATTACHMENT_PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize')); $filedata['post_attach'] = false; - return ($filedata); + return $filedata; } /* @@ -655,7 +655,7 @@ function upload_attachment($filename) $filedata['error'] = true; $filedata['err_msg'] = sprintf($user->lang['ATTACHMENT_TOO_BIG'], $allowed_filesize, $size_lang); $filedata['post_attach'] = false; - return ($filedata); + return $filedata; } // Check our complete quota @@ -666,7 +666,7 @@ function upload_attachment($filename) $filedata['error'] = true; $filedata['err_msg'] = $user->lang['ATTACH_QUOTA_REACHED']; $filedata['post_attach'] = false; - return ($filedata); + return $filedata; } } @@ -773,7 +773,7 @@ function upload_attachment($filename) $filedata['err_msg'] = $result; $filedata['post_attach'] = false; } - return ($filedata); + return $filedata; } // Move/Upload File - could be used for Avatars too ? @@ -792,7 +792,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata) { if ( !@move_uploaded_file($source_filename, $config['upload_dir'] . '/' . $destination_filename) ) { - return (sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename)); + return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename); } } @chmod($config['upload_dir'] . '/' . $destination_filename, 0666); @@ -803,7 +803,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata) { if ( !@copy($source_file, $config['upload_dir'] . '/' . $destination_filename) ) { - return (sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename)); + return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename); } } @chmod($config['upload_dir'] . '/' . $destination_filename, 0666); @@ -825,7 +825,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata) if (!$res) { @ftp_quit($conn_id); - return (sprintf($user->lang['Ftp_error_upload'], $config['ftp_path'])); + return sprintf($user->lang['Ftp_error_upload'], $config['ftp_path']); } @ftp_site($conn_id, 'CHMOD 0644 ' . $destination_filename); @@ -857,7 +857,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata) } } }*/ - return (''); + return ''; } // Delete File @@ -904,7 +904,7 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false) message_die(GENERAL_ERROR, sprintf($lang['Ftp_error_delete'], $attach_config['ftp_path'] . $add)); } - return ($deleted); + return $deleted; } @ftp_quit($conn_id); @@ -912,7 +912,7 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false) $deleted = TRUE;*/ } - return ($deleted); + return $deleted; } diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 22428c84f2..d7d5647879 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -364,6 +364,8 @@ $lang = array( 'OPTIONS' => 'Options', 'MOD_OPTIONS' => 'Moderator Options', 'POST_NORMAL' => 'Normal', + 'POST_REVIEW' => 'Post Review', + 'POST_REVIEW_EXPLAIN' => 'Since the beginning of your reply, new posts were added to this topic. You are able to review these posts now, to change yours accordingly.
This reminder will be displayed only once, if you press submit the next time your post will be stored.', 'LOCK_POST' => 'Lock Post', 'LOCK_POST_EXPLAIN' => 'Prevent editing', diff --git a/phpBB/posting.php b/phpBB/posting.php index 55793cb562..5469769f9b 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -24,36 +24,12 @@ // * topic review additions -> quoting from previous posts ? // * check for reply since started posting upon submission and display of 'between-posts' to allow re-defining of post // * hidden form element containing sid to prevent remote posting - Edwin van Vliet -// * Attachments // * bbcode parsing -> see functions_posting.php -// * lock topic option within posting // * multichoice polls // * permission defined ability for user to add poll options // * Spellcheck? aspell? or some such? // * Posting approval -// Temp Function - strtolower (will have a look at iconv later) - borrowed from php.net -function phpbb_strtolower($string) -{ - $new_string = ''; - - for ($i = 0; $i < strlen($string); $i++) - { - // Not sure about the offset, where is my ASCII Table ??? - if (ord(substr($string, $i, 1)) > 0xa0) - { - $new_string .= strtolower(substr($string, $i, 2)); - $i++; - } - else - { - $new_string .= strtolower(substr($string, $i, 1)); - } - } - - return $new_string; -} - define('IN_PHPBB', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); @@ -609,7 +585,76 @@ if (($submit) || ($preview) || ($refresh)) // notify and show user the post made between his request and the final submit if ( ($mode == 'reply' || $mode == 'quote') && ($topic_cur_post_id != $topic_last_post_id) ) { - + $template->assign_vars(array( + 'S_POST_REVIEW' => true) + ); + + // Define censored word matches + if (empty($censors)) + { + $censors = array(); + obtain_word_list($censors); + } + + // Go ahead and pull all data for the remaining posts + $sql = "SELECT u.username, u.user_id, p.* + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + AND p.post_id > " . $topic_cur_post_id . " + ORDER BY p.post_time DESC"; + $result = $db->sql_query_limit($sql, $config['posts_per_page']); + + if ($row = $db->sql_fetchrow($result)) + { + $i = 0; + do + { + $poster_id = $row['user_id']; + $poster = $row['username']; + + // Handle anon users posting with usernames + if ($poster_id == ANONYMOUS && $row['post_username'] != '') + { + $poster = $row['post_username']; + $poster_rank = $user->lang['GUEST']; + } + + $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : ''; + + $message = $row['post_text']; + + $message = (empty($row['enable_smilies']) || empty($config['allow_smilies'])) ? preg_replace('# " . $greater_post_id : "") . " ORDER BY p.post_time DESC"; $result = $db->sql_query_limit($sql, $config['posts_per_page']); @@ -1228,5 +1274,25 @@ function topic_review($topic_id, $is_inline_review = false) } } +// Temp Function - strtolower (will have a look at iconv later) - borrowed from php.net +function phpbb_strtolower($string) +{ + $new_string = ''; + + for ($i = 0; $i < strlen($string); $i++) + { + if (ord(substr($string, $i, 1)) > 0xa0) + { + $new_string .= strtolower(substr($string, $i, 2)); + $i++; + } + else + { + $new_string .= strtolower(substr($string, $i, 1)); + } + } + + return $new_string; +} ?> \ No newline at end of file diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html index 673a117d96..f02c68a92a 100644 --- a/phpBB/templates/subSilver/posting_body.html +++ b/phpBB/templates/subSilver/posting_body.html @@ -47,6 +47,59 @@ function checkForm() + + + + + + + + + + + + + + + + + +
{L_POST_REVIEW}
 
{L_POST_REVIEW_EXPLAIN}
 
+ + + + + + + + + + + + + + + + + + + +
{L_AUTHOR}{L_MESSAGE}
{post_postrow.POSTER_NAME} + + + + + + + + + +
{post_postrow.MINI_POST_IMG}{L_POSTED}: {post_postrow.POST_DATE}    {L_POST_SUBJECT}: {post_postrow.POST_SUBJECT}

{post_postrow.MESSAGE}
+ +
+
+ +