From c9dcf849b9d196f27131c21b79ebf1793f3c1cda Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 16 Aug 2007 11:28:58 +0000 Subject: [PATCH] - two new packages... diff and utf - only 60 chars for topic title if new post (please see changelog for explanation) - change utf8_wordwrap (had some bugs david and nils spotted - was not really functional, sorry for this. :D) git-svn-id: file:///svn/phpbb/trunk@8034 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/diff/diff.php | 24 ++++---- phpBB/includes/diff/engine.php | 4 +- phpBB/includes/diff/renderer.php | 12 ++-- phpBB/includes/functions_messenger.php | 8 +-- phpBB/includes/ucp/ucp_pm_compose.php | 5 ++ phpBB/includes/utf/utf_normalizer.php | 4 +- phpBB/includes/utf/utf_tools.php | 55 +++++++++++-------- phpBB/posting.php | 6 ++ .../prosilver/template/posting_editor.html | 2 +- .../subsilver2/template/posting_body.html | 2 +- 11 files changed, 72 insertions(+), 51 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cfa163a9a6..3dcb7057e1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -221,6 +221,7 @@ p a {
  • [Fix] Return to last page after voting in viewtopic instead of first page in topic (Bug #13976)
  • [Fix] If sending PM's to groups only include activated member (Bug #14040)
  • [Fix] Correctly wrap words in emails containing utf8 characters (Bug #14109)
  • +
  • [Change] For new posts or editing the first post topic titles have a maxlength of 60 characters. For any subsequent posts the length is extended to 64 to make room for the Re: part, but cutting at 60 characters. The maxlength need to be 64, else users using opera are unable to post (opera does not allow pre-filling a field with more characters than specified within the maxlength attribute)
  • diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index b18970dab4..0308297c4e 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -1,7 +1,7 @@ */ class diff @@ -226,7 +226,7 @@ class diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki */ class mapped_diff extends diff @@ -274,7 +274,7 @@ class mapped_diff extends diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -301,7 +301,7 @@ class diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -326,7 +326,7 @@ class diff_op_copy extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -347,7 +347,7 @@ class diff_op_delete extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -368,7 +368,7 @@ class diff_op_add extends diff_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -392,7 +392,7 @@ class diff_op_change extends diff_op /** * A class for computing three way diffs. * -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki */ class diff3 extends diff @@ -637,7 +637,7 @@ class diff3 extends diff } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -683,7 +683,7 @@ class diff3_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private @@ -709,7 +709,7 @@ class diff3_op_copy extends diff3_op } /** -* @package phpBB3 +* @package diff * @author Geoffrey T. Dairiki * * @access private diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index a74fa9d263..c4802c2257 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -1,7 +1,7 @@ -* @package phpBB3 +* @package diff * * @access private */ diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index e920e9688f..feb741762a 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -1,7 +1,7 @@ addresses, mail_encode($this->subject), utf8_wordwrap($this->msg), $err_msg, $headers); + $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($mail_to, mail_encode($this->subject), utf8_wordwrap($this->msg), $headers); + $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } @@ -633,12 +633,12 @@ class queue if ($config['smtp_delivery']) { - $result = smtpmail($addresses, mail_encode($subject), utf8_wordwrap($msg), $err_msg, $headers); + $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers); } else { ob_start(); - $result = $config['email_function_name']($to, mail_encode($subject), utf8_wordwrap($msg), $headers); + $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers); $err_msg = ob_get_clean(); } diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 4b92bf4042..20086e605e 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -320,6 +320,11 @@ function compose_pm($id, $mode, $action) } } + if ($action == 'post') + { + $template->assign_var('S_NEW_MESSAGE', true); + } + if (!isset($icon_id)) { $icon_id = 0; diff --git a/phpBB/includes/utf/utf_normalizer.php b/phpBB/includes/utf/utf_normalizer.php index 3332f3f744..4c705b05cb 100644 --- a/phpBB/includes/utf/utf_normalizer.php +++ b/phpBB/includes/utf/utf_normalizer.php @@ -1,7 +1,7 @@ ''); $index = 0; - foreach ($words as $word) + foreach ($lines as $line) { - if (!isset($lines[$index])) + $words = explode(' ', $line); + + for ($i = 0, $size = sizeof($words); $i < $size; $i++) { - $lines[$index] = ''; + $word = $words[$i]; + + // If cut is true we need to cut the word if it is > width chars + if ($cut && utf8_strlen($word) > $width) + { + $words[$i] = utf8_substr($word, $width); + $word = utf8_substr($word, 0, $width); + $i--; + } + + if (utf8_strlen($new_lines[$index] . $word) > $width) + { + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + $new_lines[$index] .= $word . ' '; } - if (!empty($lines[$index]) && utf8_strlen($lines[$index]) > $width) - { - $lines[$index] = substr($lines[$index], 0, -1); - $index++; - $lines[$index] = ''; - } - - $lines[$index] .= $word . ' '; + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; } - return implode($break, $lines); + unset($new_lines[$index]); + return implode($break, $new_lines); } ?> \ No newline at end of file diff --git a/phpBB/posting.php b/phpBB/posting.php index af357a90b9..71e0dfc2c7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -324,6 +324,11 @@ if ($mode == 'bump') trigger_error('BUMP_ERROR'); } +// Subject length limiting to 60 characters if first post... +if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id'])) +{ + $template->assign_var('S_NEW_MESSAGE', true); +} // Determine some vars if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) @@ -334,6 +339,7 @@ else { $post_data['quote_username'] = isset($post_data['username']) ? $post_data['username'] : ''; } + $post_data['post_edit_locked'] = (isset($post_data['post_edit_locked'])) ? (int) $post_data['post_edit_locked'] : 0; $post_data['post_subject'] = (in_array($mode, array('quote', 'edit'))) ? $post_data['post_subject'] : ((isset($post_data['topic_title'])) ? $post_data['topic_title'] : ''); $post_data['topic_time_limit'] = (isset($post_data['topic_time_limit'])) ? (($post_data['topic_time_limit']) ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit']) : 0; diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 26cbe54387..8a3e582cb2 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -93,7 +93,7 @@
    -
    +
    diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index ba4df7da89..744fcb4189 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -173,7 +173,7 @@ {L_SUBJECT}: - + {L_MESSAGE_BODY}:
    {L_MESSAGE_BODY_EXPLAIN}