1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-03 07:18:08 +02:00

merge? merge.

git-svn-id: file:///svn/phpbb/trunk@8672 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2008-06-23 18:22:44 +00:00
parent 3892e7330a
commit ad739a358c
14 changed files with 153 additions and 116 deletions

View File

@@ -1032,7 +1032,7 @@ function get_schema_struct()
'topic_id' => array('UINT', 0), 'topic_id' => array('UINT', 0),
'forum_id' => array('UINT', 0), 'forum_id' => array('UINT', 0),
'save_time' => array('TIMESTAMP', 0), 'save_time' => array('TIMESTAMP', 0),
'draft_subject' => array('XSTEXT_UNI', ''), 'draft_subject' => array('STEXT_UNI', ''),
'draft_message' => array('MTEXT_UNI', ''), 'draft_message' => array('MTEXT_UNI', ''),
), ),
'PRIMARY_KEY' => 'draft_id', 'PRIMARY_KEY' => 'draft_id',
@@ -1094,7 +1094,7 @@ function get_schema_struct()
'forum_topics_real' => array('UINT', 0), 'forum_topics_real' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0),
'forum_last_poster_id' => array('UINT', 0), 'forum_last_poster_id' => array('UINT', 0),
'forum_last_post_subject' => array('XSTEXT_UNI', ''), 'forum_last_post_subject' => array('STEXT_UNI', ''),
'forum_last_post_time' => array('TIMESTAMP', 0), 'forum_last_post_time' => array('TIMESTAMP', 0),
'forum_last_poster_name'=> array('VCHAR_UNI', ''), 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''), 'forum_last_poster_colour'=> array('VCHAR:6', ''),
@@ -1308,7 +1308,7 @@ function get_schema_struct()
'enable_magic_url' => array('BOOL', 1), 'enable_magic_url' => array('BOOL', 1),
'enable_sig' => array('BOOL', 1), 'enable_sig' => array('BOOL', 1),
'post_username' => array('VCHAR_UNI:255', ''), 'post_username' => array('VCHAR_UNI:255', ''),
'post_subject' => array('XSTEXT_UNI', '', 'true_sort'), 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
'post_text' => array('MTEXT_UNI', ''), 'post_text' => array('MTEXT_UNI', ''),
'post_checksum' => array('VCHAR:32', ''), 'post_checksum' => array('VCHAR:32', ''),
'post_attachment' => array('BOOL', 0), 'post_attachment' => array('BOOL', 0),
@@ -1344,7 +1344,7 @@ function get_schema_struct()
'enable_smilies' => array('BOOL', 1), 'enable_smilies' => array('BOOL', 1),
'enable_magic_url' => array('BOOL', 1), 'enable_magic_url' => array('BOOL', 1),
'enable_sig' => array('BOOL', 1), 'enable_sig' => array('BOOL', 1),
'message_subject' => array('XSTEXT_UNI', ''), 'message_subject' => array('STEXT_UNI', ''),
'message_text' => array('MTEXT_UNI', ''), 'message_text' => array('MTEXT_UNI', ''),
'message_edit_reason' => array('STEXT_UNI', ''), 'message_edit_reason' => array('STEXT_UNI', ''),
'message_edit_user' => array('UINT', 0), 'message_edit_user' => array('UINT', 0),
@@ -1562,6 +1562,7 @@ function get_schema_struct()
'KEYS' => array( 'KEYS' => array(
'session_time' => array('INDEX', 'session_time'), 'session_time' => array('INDEX', 'session_time'),
'session_user_id' => array('INDEX', 'session_user_id'), 'session_user_id' => array('INDEX', 'session_user_id'),
'session_fid' => array('INDEX', 'session_forum_id'),
), ),
); );
@@ -1707,7 +1708,7 @@ function get_schema_struct()
'topic_attachment' => array('BOOL', 0), 'topic_attachment' => array('BOOL', 0),
'topic_approved' => array('BOOL', 1), 'topic_approved' => array('BOOL', 1),
'topic_reported' => array('BOOL', 0), 'topic_reported' => array('BOOL', 0),
'topic_title' => array('XSTEXT_UNI', '', 'true_sort'), 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
'topic_poster' => array('UINT', 0), 'topic_poster' => array('UINT', 0),
'topic_time' => array('TIMESTAMP', 0), 'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0),
@@ -1723,7 +1724,7 @@ function get_schema_struct()
'topic_last_poster_id' => array('UINT', 0), 'topic_last_poster_id' => array('UINT', 0),
'topic_last_poster_name' => array('VCHAR_UNI', ''), 'topic_last_poster_name' => array('VCHAR_UNI', ''),
'topic_last_poster_colour' => array('VCHAR:6', ''), 'topic_last_poster_colour' => array('VCHAR:6', ''),
'topic_last_post_subject' => array('XSTEXT_UNI', ''), 'topic_last_post_subject' => array('STEXT_UNI', ''),
'topic_last_post_time' => array('TIMESTAMP', 0), 'topic_last_post_time' => array('TIMESTAMP', 0),
'topic_last_view_time' => array('TIMESTAMP', 0), 'topic_last_view_time' => array('TIMESTAMP', 0),
'topic_moved_id' => array('UINT', 0), 'topic_moved_id' => array('UINT', 0),

View File

@@ -22,13 +22,15 @@ involved in phpBB.
phpBB Lead Developer : Acyd Burn (Meik Sievertsen) phpBB Lead Developer : Acyd Burn (Meik Sievertsen)
phpBB Developers : DavidMJ (David M.) phpBB Developers : APTX (Marek A. R.)
DavidMJ (David M.)
dhn (Dominik Dr<44>scher) dhn (Dominik Dr<44>scher)
kellanved (Henry Sudhof) kellanved (Henry Sudhof)
naderman (Nils Adermann) naderman (Nils Adermann)
subBlue (Tom Beddard) ToonArmy (Chris Smith)
Vic D'Elfant (Vic D'Elfant) Vic D'Elfant (Vic D'Elfant)
-- Previous Contributors -- -- Previous Contributors --
phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007] phpBB Project Manager : theFinn (James Atkinson) [Founder - 04/2007]

View File

@@ -745,7 +745,7 @@ function tz_select($default = '', $truncate = false)
{ {
if ($truncate) if ($truncate)
{ {
$zone_trunc = truncate_string($zone, 50, false, '...'); $zone_trunc = truncate_string($zone, 50, 255, false, '...');
} }
else else
{ {

View File

@@ -435,6 +435,7 @@ function generate_text_for_display($text, $uid, $bitfield, $flags)
function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
{ {
$uid = $bitfield = ''; $uid = $bitfield = '';
$flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0);
if (!$text) if (!$text)
{ {
@@ -458,7 +459,6 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
$uid = ''; $uid = '';
} }
$flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0);
$bitfield = $message_parser->bbcode_bitfield; $bitfield = $message_parser->bbcode_bitfield;
return; return;
@@ -1062,8 +1062,16 @@ function extension_allowed($forum_id, $extension, &$extensions)
/** /**
* Truncates string while retaining special characters if going over the max length * Truncates string while retaining special characters if going over the max length
* The default max length is 60 at the moment * The default max length is 60 at the moment
* The maximum storage length is there to fit the string within the given length. The string may be further truncated due to html entities.
* For example: string given is 'a "quote"' (length: 9), would be a stored as 'a &quot;quote&quot;' (length: 19)
*
* @param string $string The text to truncate to the given length. String is specialchared.
* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
* @param bool $allow_reply Allow Re: in front of string
* @param string $append String to be appended
*/ */
function truncate_string($string, $max_length = 60, $allow_reply = true, $append = '') function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = true, $append = '')
{ {
$chars = array(); $chars = array();
@@ -1086,6 +1094,21 @@ function truncate_string($string, $max_length = 60, $allow_reply = true, $append
$stripped = true; $stripped = true;
} }
// Due to specialchars, we may not be able to store the string...
if (utf8_strlen($string) > $max_store_length)
{
// let's split again, we do not want half-baked strings where entities are split
$_chars = utf8_str_split(htmlspecialchars_decode($string));
$chars = array_map('utf8_htmlspecialchars', $_chars);
do
{
array_pop($chars);
$string = implode('', $chars);
}
while (utf8_strlen($string) > $max_store_length || !sizeof($chars));
}
if ($strip_reply) if ($strip_reply)
{ {
$string = 'Re: ' . $string; $string = 'Re: ' . $string;

View File

@@ -1282,7 +1282,7 @@ function restore_config($schema)
// Most are... // Most are...
if (is_string($config_value)) if (is_string($config_value))
{ {
$config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, false); $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false);
} }
set_config($config_name, $config_value); set_config($config_name, $config_value);

View File

@@ -1646,7 +1646,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Display edit info if edit reason given or user is editing his post, which is not the last within the topic. // Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
{ {
$data['post_edit_reason'] = truncate_string($data['post_edit_reason'], 255, false); $data['post_edit_reason'] = truncate_string($data['post_edit_reason'], 255, 255, false);
$sql_data[POSTS_TABLE]['sql'] = array( $sql_data[POSTS_TABLE]['sql'] = array(
'post_edit_time' => $current_time, 'post_edit_time' => $current_time,

View File

@@ -733,13 +733,8 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
case 'user': case 'user':
$type = 'ban_userid'; $type = 'ban_userid';
if (in_array('*', $ban_list)) // At the moment we do not support wildcard username banning
{
// Ban all users (it's a good thing that you can exclude people)
$banlist_ary[] = '*';
}
else
{
// Select the relevant user_ids. // Select the relevant user_ids.
$sql_usernames = array(); $sql_usernames = array();
@@ -793,10 +788,10 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
} }
else else
{ {
$db->sql_freeresult($result);
trigger_error('NO_USERS'); trigger_error('NO_USERS');
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
}
break; break;
case 'ip': case 'ip':
@@ -996,7 +991,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
switch ($mode) switch ($mode)
{ {
case 'user': case 'user':
$sql_where = (in_array('*', $banlist_ary)) ? '' : 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary); $sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary);
break; break;
case 'ip': case 'ip':

View File

@@ -400,7 +400,10 @@ class bbcode_firstpass extends bbcode
case 'php': case 'php':
$remove_tags = false; $remove_tags = false;
$code = str_replace(array('&lt;', '&gt;'), array('<', '>'), $code);
$str_from = array('&lt;', '&gt;', '&#91;', '&#93;', '&#46;', '&#58;', '&#058;');
$str_to = array('<', '>', '[', ']', '.', ':', ':');
$code = str_replace($str_from, $str_to, $code);
if (!preg_match('/\<\?.*?\?\>/is', $code)) if (!preg_match('/\<\?.*?\?\>/is', $code))
{ {

View File

@@ -1113,6 +1113,14 @@ class session
// To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again
$this->session_kill(false); $this->session_kill(false);
// A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page
if (defined('IN_CRON'))
{
garbage_collection();
exit_handler();
exit;
}
trigger_error($message); trigger_error($message);
} }
@@ -1582,6 +1590,7 @@ class user extends session
$localised_images = true; $localised_images = true;
} }
$row['image_filename'] = rawurlencode($row['image_filename']);
$this->img_array[$row['image_name']] = $row; $this->img_array[$row['image_name']] = $row;
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);

View File

@@ -8,7 +8,7 @@
* *
*/ */
$updates_to_version = '3.1.0'; $updates_to_version = '3.0.2-RC2';
// Return if we "just include it" to find out for which version the database update is responsuble for // Return if we "just include it" to find out for which version the database update is responsuble for
if (defined('IN_PHPBB') && defined('IN_INSTALL')) if (defined('IN_PHPBB') && defined('IN_INSTALL'))

View File

@@ -205,7 +205,7 @@ $schema_data['phpbb_drafts'] = array(
'topic_id' => array('UINT', 0), 'topic_id' => array('UINT', 0),
'forum_id' => array('UINT', 0), 'forum_id' => array('UINT', 0),
'save_time' => array('TIMESTAMP', 0), 'save_time' => array('TIMESTAMP', 0),
'draft_subject' => array('XSTEXT_UNI', ''), 'draft_subject' => array('STEXT_UNI', ''),
'draft_message' => array('MTEXT_UNI', ''), 'draft_message' => array('MTEXT_UNI', ''),
), ),
'PRIMARY_KEY' => 'draft_id', 'PRIMARY_KEY' => 'draft_id',
@@ -267,7 +267,7 @@ $schema_data['phpbb_forums'] = array(
'forum_topics_real' => array('UINT', 0), 'forum_topics_real' => array('UINT', 0),
'forum_last_post_id' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0),
'forum_last_poster_id' => array('UINT', 0), 'forum_last_poster_id' => array('UINT', 0),
'forum_last_post_subject' => array('XSTEXT_UNI', ''), 'forum_last_post_subject' => array('STEXT_UNI', ''),
'forum_last_post_time' => array('TIMESTAMP', 0), 'forum_last_post_time' => array('TIMESTAMP', 0),
'forum_last_poster_name'=> array('VCHAR_UNI', ''), 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''), 'forum_last_poster_colour'=> array('VCHAR:6', ''),
@@ -482,7 +482,7 @@ $schema_data['phpbb_posts'] = array(
'enable_magic_url' => array('BOOL', 1), 'enable_magic_url' => array('BOOL', 1),
'enable_sig' => array('BOOL', 1), 'enable_sig' => array('BOOL', 1),
'post_username' => array('VCHAR_UNI:255', ''), 'post_username' => array('VCHAR_UNI:255', ''),
'post_subject' => array('XSTEXT_UNI', '', 'true_sort'), 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
'post_text' => array('MTEXT_UNI', ''), 'post_text' => array('MTEXT_UNI', ''),
'post_checksum' => array('VCHAR:32', ''), 'post_checksum' => array('VCHAR:32', ''),
'post_attachment' => array('BOOL', 0), 'post_attachment' => array('BOOL', 0),
@@ -518,7 +518,7 @@ $schema_data['phpbb_privmsgs'] = array(
'enable_smilies' => array('BOOL', 1), 'enable_smilies' => array('BOOL', 1),
'enable_magic_url' => array('BOOL', 1), 'enable_magic_url' => array('BOOL', 1),
'enable_sig' => array('BOOL', 1), 'enable_sig' => array('BOOL', 1),
'message_subject' => array('XSTEXT_UNI', ''), 'message_subject' => array('STEXT_UNI', ''),
'message_text' => array('MTEXT_UNI', ''), 'message_text' => array('MTEXT_UNI', ''),
'message_edit_reason' => array('STEXT_UNI', ''), 'message_edit_reason' => array('STEXT_UNI', ''),
'message_edit_user' => array('UINT', 0), 'message_edit_user' => array('UINT', 0),
@@ -736,7 +736,8 @@ $schema_data['phpbb_sessions'] = array(
'PRIMARY_KEY' => 'session_id', 'PRIMARY_KEY' => 'session_id',
'KEYS' => array( 'KEYS' => array(
'session_time' => array('INDEX', 'session_time'), 'session_time' => array('INDEX', 'session_time'),
'session_user_id' => array('INDEX', 'session_user_id'), 'session_uid' => array('INDEX', 'session_user_id'),
'session_fid' => array('INDEX', 'session_forum_id'),
), ),
); );
@@ -882,7 +883,7 @@ $schema_data['phpbb_topics'] = array(
'topic_attachment' => array('BOOL', 0), 'topic_attachment' => array('BOOL', 0),
'topic_approved' => array('BOOL', 1), 'topic_approved' => array('BOOL', 1),
'topic_reported' => array('BOOL', 0), 'topic_reported' => array('BOOL', 0),
'topic_title' => array('XSTEXT_UNI', '', 'true_sort'), 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
'topic_poster' => array('UINT', 0), 'topic_poster' => array('UINT', 0),
'topic_time' => array('TIMESTAMP', 0), 'topic_time' => array('TIMESTAMP', 0),
'topic_time_limit' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0),
@@ -898,7 +899,7 @@ $schema_data['phpbb_topics'] = array(
'topic_last_poster_id' => array('UINT', 0), 'topic_last_poster_id' => array('UINT', 0),
'topic_last_poster_name' => array('VCHAR_UNI', ''), 'topic_last_poster_name' => array('VCHAR_UNI', ''),
'topic_last_poster_colour' => array('VCHAR:6', ''), 'topic_last_poster_colour' => array('VCHAR:6', ''),
'topic_last_post_subject' => array('XSTEXT_UNI', ''), 'topic_last_post_subject' => array('STEXT_UNI', ''),
'topic_last_post_time' => array('TIMESTAMP', 0), 'topic_last_post_time' => array('TIMESTAMP', 0),
'topic_last_view_time' => array('TIMESTAMP', 0), 'topic_last_view_time' => array('TIMESTAMP', 0),
'topic_moved_id' => array('UINT', 0), 'topic_moved_id' => array('UINT', 0),

View File

@@ -466,6 +466,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
// define some vars for urls // define some vars for urls
$hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')', '&quot;'), ' ', $keywords)))); $hilit = implode('|', explode(' ', preg_replace('#\s+#u', ' ', str_replace(array('+', '-', '|', '(', ')', '&quot;'), ' ', $keywords))));
// Do not allow *only* wildcard being used for hilight
$hilit = (strspn($hilit, '*') === strlen($hilit)) ? '' : $hilit;
$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit))); $u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
$u_show_results = ($show_results != 'posts') ? '&amp;sr=' . $show_results : ''; $u_show_results = ($show_results != 'posts') ? '&amp;sr=' . $show_results : '';
$u_search_forum = implode('&amp;fid%5B%5D=', $search_forum); $u_search_forum = implode('&amp;fid%5B%5D=', $search_forum);

View File

@@ -4,7 +4,7 @@
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<h2>{MESSAGE_TITLE}</h2> <h2>{MESSAGE_TITLE}</h2>
<p>{MESSAGE_TEXT}</p> <p>{MESSAGE_TEXT}</p>
<!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH --><p><a href="{U_SEARCH}" class="{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF --> <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF -->
<span class="corners-bottom"><span></span></span></div> <span class="corners-bottom"><span></span></span></div>
</div> </div>

View File

@@ -35,7 +35,7 @@
</td> </td>
<td class="row1"> <td class="row1">
<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF --> <!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
{topicrow.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> {searchresults.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --> <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
<a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a>&nbsp; <a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a>&nbsp;
<!-- ENDIF --> <!-- ENDIF -->