mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- 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
This commit is contained in:
parent
2bbd2fb1f9
commit
c9dcf849b9
11 changed files with 72 additions and 51 deletions
|
@ -221,6 +221,7 @@ p a {
|
||||||
<li>[Fix] Return to last page after voting in viewtopic instead of first page in topic (Bug #13976)</li>
|
<li>[Fix] Return to last page after voting in viewtopic instead of first page in topic (Bug #13976)</li>
|
||||||
<li>[Fix] If sending PM's to groups only include activated member (Bug #14040)</li>
|
<li>[Fix] If sending PM's to groups only include activated member (Bug #14040)</li>
|
||||||
<li>[Fix] Correctly wrap words in emails containing utf8 characters (Bug #14109)</li>
|
<li>[Fix] Correctly wrap words in emails containing utf8 characters (Bug #14109)</li>
|
||||||
|
<li>[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)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2006 phpBB Group
|
* @copyright (c) 2006 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* General API for generating and formatting diffs - the differences between
|
* General API for generating and formatting diffs - the differences between
|
||||||
* two sequences of strings.
|
* two sequences of strings.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*/
|
*/
|
||||||
class diff
|
class diff
|
||||||
|
@ -226,7 +226,7 @@ class diff
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*/
|
*/
|
||||||
class mapped_diff extends diff
|
class mapped_diff extends diff
|
||||||
|
@ -274,7 +274,7 @@ class mapped_diff extends diff
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -301,7 +301,7 @@ class diff_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -326,7 +326,7 @@ class diff_op_copy extends diff_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -347,7 +347,7 @@ class diff_op_delete extends diff_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -368,7 +368,7 @@ class diff_op_add extends diff_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -392,7 +392,7 @@ class diff_op_change extends diff_op
|
||||||
/**
|
/**
|
||||||
* A class for computing three way diffs.
|
* A class for computing three way diffs.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*/
|
*/
|
||||||
class diff3 extends diff
|
class diff3 extends diff
|
||||||
|
@ -637,7 +637,7 @@ class diff3 extends diff
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -683,7 +683,7 @@ class diff3_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -709,7 +709,7 @@ class diff3_op_copy extends diff3_op
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2006 phpBB Group
|
* @copyright (c) 2006 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
@ -41,7 +41,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* code was written by him, and is used/adapted with his permission.
|
* code was written by him, and is used/adapted with his permission.
|
||||||
*
|
*
|
||||||
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2006 phpBB Group
|
* @copyright (c) 2006 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
@ -27,7 +27,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* This class renders the diff in classic diff format. It is intended that
|
* This class renders the diff in classic diff format. It is intended that
|
||||||
* this class be customized via inheritance, to obtain fancier outputs.
|
* this class be customized via inheritance, to obtain fancier outputs.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*/
|
*/
|
||||||
class diff_renderer
|
class diff_renderer
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ class diff_renderer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a unified diff
|
* Renders a unified diff
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*/
|
*/
|
||||||
class diff_renderer_unified extends diff_renderer
|
class diff_renderer_unified extends diff_renderer
|
||||||
{
|
{
|
||||||
|
@ -340,7 +340,7 @@ class diff_renderer_unified extends diff_renderer
|
||||||
* This class renders diffs in the Wiki-style "inline" format.
|
* This class renders diffs in the Wiki-style "inline" format.
|
||||||
*
|
*
|
||||||
* @author Ciprian Popovici
|
* @author Ciprian Popovici
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*/
|
*/
|
||||||
class diff_renderer_inline extends diff_renderer
|
class diff_renderer_inline extends diff_renderer
|
||||||
{
|
{
|
||||||
|
@ -503,7 +503,7 @@ class diff_renderer_inline extends diff_renderer
|
||||||
* "raw" diff renderer.
|
* "raw" diff renderer.
|
||||||
* This class could be used to output a raw unified patch file
|
* This class could be used to output a raw unified patch file
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*/
|
*/
|
||||||
class diff_renderer_raw extends diff_renderer
|
class diff_renderer_raw extends diff_renderer
|
||||||
{
|
{
|
||||||
|
@ -557,7 +557,7 @@ class diff_renderer_raw extends diff_renderer
|
||||||
* "chora (Horde)" diff renderer - similar style.
|
* "chora (Horde)" diff renderer - similar style.
|
||||||
* This renderer class is a modified human_readable function from the Horde Framework.
|
* This renderer class is a modified human_readable function from the Horde Framework.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package diff
|
||||||
*/
|
*/
|
||||||
class diff_renderer_side_by_side extends diff_renderer
|
class diff_renderer_side_by_side extends diff_renderer
|
||||||
{
|
{
|
||||||
|
|
|
@ -399,12 +399,12 @@ class messenger
|
||||||
|
|
||||||
if ($config['smtp_delivery'])
|
if ($config['smtp_delivery'])
|
||||||
{
|
{
|
||||||
$result = smtpmail($this->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
|
else
|
||||||
{
|
{
|
||||||
ob_start();
|
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();
|
$err_msg = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,12 +633,12 @@ class queue
|
||||||
|
|
||||||
if ($config['smtp_delivery'])
|
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
|
else
|
||||||
{
|
{
|
||||||
ob_start();
|
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();
|
$err_msg = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,11 @@ function compose_pm($id, $mode, $action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'post')
|
||||||
|
{
|
||||||
|
$template->assign_var('S_NEW_MESSAGE', true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($icon_id))
|
if (!isset($icon_id))
|
||||||
{
|
{
|
||||||
$icon_id = 0;
|
$icon_id = 0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package utf
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2005 phpBB Group
|
* @copyright (c) 2005 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
@ -57,7 +57,7 @@ define('UNICODE_JAMO_T', 2);
|
||||||
/**
|
/**
|
||||||
* Unicode normalization routines
|
* Unicode normalization routines
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package utf
|
||||||
*/
|
*/
|
||||||
class utf_normalizer
|
class utf_normalizer
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package utf
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @copyright (c) 2006 phpBB Group
|
* @copyright (c) 2006 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
@ -24,7 +24,7 @@ setlocale(LC_CTYPE, 'C');
|
||||||
* Whenever possible, these functions will try to use PHP's built-in functions or
|
* Whenever possible, these functions will try to use PHP's built-in functions or
|
||||||
* extensions, otherwise they will default to custom routines.
|
* extensions, otherwise they will default to custom routines.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package utf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!extension_loaded('xml'))
|
if (!extension_loaded('xml'))
|
||||||
|
@ -1874,35 +1874,44 @@ function utf8_convert_message($message)
|
||||||
*/
|
*/
|
||||||
function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false)
|
function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false)
|
||||||
{
|
{
|
||||||
// If cutting, we just split by $width chars
|
// We first need to explode on $break, not destroying existing (intended) breaks
|
||||||
if ($cut)
|
$lines = explode($break, $string);
|
||||||
{
|
$new_lines = array(0 => '');
|
||||||
return implode($break, utf8_str_split($string, $width));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not cutting, we first need to explode on spacer and then merge
|
|
||||||
$words = explode(' ', $string);
|
|
||||||
$lines = array();
|
|
||||||
$index = 0;
|
$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 (!empty($lines[$index]) && utf8_strlen($lines[$index]) > $width)
|
if (utf8_strlen($new_lines[$index] . $word) > $width)
|
||||||
{
|
{
|
||||||
$lines[$index] = substr($lines[$index], 0, -1);
|
$new_lines[$index] = substr($new_lines[$index], 0, -1);
|
||||||
$index++;
|
$index++;
|
||||||
$lines[$index] = '';
|
$new_lines[$index] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines[$index] .= $word . ' ';
|
$new_lines[$index] .= $word . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode($break, $lines);
|
$new_lines[$index] = substr($new_lines[$index], 0, -1);
|
||||||
|
$index++;
|
||||||
|
$new_lines[$index] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($new_lines[$index]);
|
||||||
|
return implode($break, $new_lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -324,6 +324,11 @@ if ($mode == 'bump')
|
||||||
trigger_error('BUMP_ERROR');
|
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
|
// Determine some vars
|
||||||
if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS)
|
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['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_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['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;
|
$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;
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
<!-- IF S_POST_ACTION or S_PRIVMSGS or S_EDIT_DRAFT -->
|
<!-- IF S_POST_ACTION or S_PRIVMSGS or S_EDIT_DRAFT -->
|
||||||
<dl style="clear: left;">
|
<dl style="clear: left;">
|
||||||
<dt><label for="subject">{L_SUBJECT}:</label></dt>
|
<dt><label for="subject">{L_SUBJECT}:</label></dt>
|
||||||
<dd><input type="text" name="subject" id="subject" size="45" maxlength="64" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
|
<dd><input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- IF S_CONFIRM_CODE -->
|
<!-- IF S_CONFIRM_CODE -->
|
||||||
<dl>
|
<dl>
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" width="22%"><b class="genmed">{L_SUBJECT}:</b></td>
|
<td class="row1" width="22%"><b class="genmed">{L_SUBJECT}:</b></td>
|
||||||
<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="64" tabindex="2" value="{SUBJECT}" /></td>
|
<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" valign="top"><b class="genmed">{L_MESSAGE_BODY}:</b><br /><span class="gensmall">{L_MESSAGE_BODY_EXPLAIN} </span><br /><br />
|
<td class="row1" valign="top"><b class="genmed">{L_MESSAGE_BODY}:</b><br /><span class="gensmall">{L_MESSAGE_BODY_EXPLAIN} </span><br /><br />
|
||||||
|
|
Loading…
Add table
Reference in a new issue