diff options
author | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:41 +0100 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:41 +0100 |
commit | 723e38ece20f7a7a3611b86a4feafeb28560ce02 (patch) | |
tree | 705f26afa4b1ff84f830bec9545ab1b8e9479305 /phpBB/includes | |
parent | 6ebc26e330d5e204eab0ac9061bb5817534047fe (diff) | |
parent | 199bb1366018c61fe9c140d711369a92d576e757 (diff) | |
download | forums-723e38ece20f7a7a3611b86a4feafeb28560ce02.tar forums-723e38ece20f7a7a3611b86a4feafeb28560ce02.tar.gz forums-723e38ece20f7a7a3611b86a4feafeb28560ce02.tar.bz2 forums-723e38ece20f7a7a3611b86a4feafeb28560ce02.tar.xz forums-723e38ece20f7a7a3611b86a4feafeb28560ce02.zip |
Merge commit 'release-3.0.6-RC4'
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_forums.php | 7 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_icons.php | 47 | ||||
-rw-r--r-- | phpBB/includes/captcha/captcha_factory.php | 2 | ||||
-rw-r--r-- | phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 12 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 2 | ||||
-rw-r--r-- | phpBB/includes/db/db_tools.php | 8 | ||||
-rw-r--r-- | phpBB/includes/db/oracle.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 11 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_jabber.php | 3 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 17 | ||||
-rw-r--r-- | phpBB/includes/questionnaire/questionnaire.php | 1 |
12 files changed, 69 insertions, 45 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 2ff597ee98..cc56aba369 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -125,7 +125,6 @@ class acp_forums 'type_action' => request_var('type_action', ''), 'forum_status' => request_var('forum_status', ITEM_UNLOCKED), 'forum_parents' => '', - 'forum_options' => 0, 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'forum_link' => request_var('forum_link', ''), 'forum_link_track' => request_var('forum_link_track', false), @@ -159,6 +158,12 @@ class acp_forums 'forum_password_unset' => request_var('forum_password_unset', false), ); + // On add, add empty forum_options... else do not consider it (not updating it) + if ($action == 'add') + { + $forum_data['forum_options'] = 0; + } + // Use link_display_on_index setting if forum type is link if ($forum_data['forum_type'] == FORUM_LINK) { diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 8213c55ccb..e1deb7e533 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -89,16 +89,19 @@ class acp_icons continue; } - // adjust the width and height to be lower than 128px while perserving the aspect ratio - if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) + // adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons) + if ($mode == 'icons') { - $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); - $img_size[0] = 127; - } - else if ($img_size[1] > 127) - { - $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); - $img_size[1] = 127; + if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) + { + $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); + $img_size[0] = 127; + } + else if ($img_size[1] > 127) + { + $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); + $img_size[1] = 127; + } } $_images[$path . $img]['file'] = $path . $img; @@ -363,7 +366,7 @@ class acp_icons if ($mode == 'smilies' && $action == 'create') { $smiley_count = $this->item_count($table); - + $addable_smileys_count = sizeof($images); foreach ($images as $image) { @@ -372,7 +375,7 @@ class acp_icons --$addable_smileys_count; } } - + if ($smiley_count + $addable_smileys_count > SMILEY_LIMIT) { trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); @@ -400,15 +403,19 @@ class acp_icons $image_height[$image] = $img_size[1]; } - if ($image_width[$image] > 127 && $image_width[$image] > $image_height[$image]) + // Adjust image width/height for icons + if ($mode == 'icons') { - $image_height[$image] = (int) ($image_height[$image] * (127 / $image_width[$image])); - $image_width[$image] = 127; - } - else if ($image_height[$image] > 127) - { - $image_width[$image] = (int) ($image_width[$image] * (127 / $image_height[$image])); - $image_height[$image] = 127; + if ($image_width[$image] > 127 && $image_width[$image] > $image_height[$image]) + { + $image_height[$image] = (int) ($image_height[$image] * (127 / $image_width[$image])); + $image_width[$image] = 127; + } + else if ($image_height[$image] > 127) + { + $image_width[$image] = (int) ($image_width[$image] * (127 / $image_height[$image])); + $image_height[$image] = 127; + } } $img_sql = array( @@ -923,7 +930,7 @@ class acp_icons generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true) ); } - + /** * Returns the count of smilies or icons in the database * diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php index 73406a954f..131c0b3b77 100644 --- a/phpBB/includes/captcha/captcha_factory.php +++ b/phpBB/includes/captcha/captcha_factory.php @@ -35,7 +35,7 @@ class phpbb_captcha_factory { include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); } - $instance =& call_user_func(array($name, 'get_instance')); + $instance = call_user_func(array($name, 'get_instance')); return $instance; } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index c17cfa7bbe..45811c5d26 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -53,7 +53,7 @@ class phpbb_captcha_qa // read input $this->confirm_id = request_var('qa_confirm_id', ''); - $this->answer = request_var('qa_answer', '', true); + $this->answer = utf8_normalize_nfc(request_var('qa_answer', '', true)); $this->type = (int) $type; $this->question_lang = $user->lang_name; @@ -502,7 +502,7 @@ class phpbb_captcha_qa { global $db; - $answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true)); + $answer = ($this->question_strict) ? utf8_normalize_nfc(request_var('qa_answer', '', true)) : utf8_clean_string(utf8_normalize_nfc(request_var('qa_answer', '', true))); $sql = 'SELECT answer_text FROM ' . CAPTCHA_ANSWERS_TABLE . ' @@ -789,11 +789,12 @@ class phpbb_captcha_qa */ function acp_get_question_input() { + $answers = utf8_normalize_nfc(request_var('answers', '', true)); $question = array( 'question_text' => request_var('question_text', '', true), 'strict' => request_var('strict', false), 'lang_iso' => request_var('lang_iso', ''), - 'answers' => explode("\n", request_var('answers', '', true)), + 'answers' => (strlen($answers)) ? explode("\n", $answers) : '', ); return $question; @@ -908,8 +909,9 @@ class phpbb_captcha_qa } if (!isset($langs[$question_data['lang_iso']]) || - !$question_data['question_text'] || - !sizeof($question_data['answers'])) + !strlen($question_data['question_text']) || + !sizeof($question_data['answers']) || + !is_array($question_data['answers'])) { return false; } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 267a0220ed..7106c4efa9 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.6-RC3'); +define('PHPBB_VERSION', '3.0.6-RC4'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index eabcfd818e..a762b31681 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -453,11 +453,17 @@ class phpbb_db_tools case 'firebird': case 'mssql': + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); foreach ($primary_key_stmts as $pk_stmt) { $statements[] = $pk_stmt; } + + $this->return_statements = $old_return_statements; break; case 'oracle': @@ -1867,7 +1873,7 @@ class phpbb_db_tools } else { - $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql']; + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN "' . strtoupper($column_name) . '" TYPE ' . ' ' . $column_data['column_type_sql_type']; } break; diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index f7180029b5..63cdb7126d 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -136,7 +136,7 @@ class dbal_oracle extends dbal */ function _rewrite_where($where_clause) { - preg_match_all('/\s*(AND|OR)?\s*([\w_.]++)\s*(?:(=|<[=>]?|>=?)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); + preg_match_all('/\s*(AND|OR)?\s*([\w_.()]++)\s*(?:(=|<[=>]?|>=?|LIKE)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.()]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); $out = ''; foreach ($result as $val) { diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index c0db64dbfb..92dcf60ee0 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2549,17 +2549,24 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id return; } - $keywords = preg_split('#[\s+\-|*()]+#u', utf8_strtolower(preg_quote($keywords, '#')), 0, PREG_SPLIT_NO_EMPTY); + // Use no preg_quote for $keywords because this would lead to sole backslashes being added + // We also use an OR connection here for spaces and the | string. Currently, regex is not supported for searching (but may come later). + $keywords = preg_split('#[\s|]+#u', utf8_strtolower($keywords), 0, PREG_SPLIT_NO_EMPTY); $sql_keywords = ''; if (!empty($keywords)) { - $keywords_pattern = '#' . implode('|', $keywords) . '#ui'; + $keywords_pattern = array(); + + // Build pattern and keywords... for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) { + $keywords_pattern[] = preg_quote($keywords[$i], '#'); $keywords[$i] = $db->sql_like_expression($db->any_char . $keywords[$i] . $db->any_char); } + $keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui'; + $operations = array(); foreach ($user->lang as $key => $value) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index cec1becb6e..58cbdaef5b 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -323,7 +323,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false; // Mark the first visible forum on index as unread if there's any unread global announcement - if (($forum_id == $forum_ids_moderator[0]) && ($root_data['forum_id'] == 0) && $ga_unread) + if ($ga_unread && !empty($forum_ids_moderator) && $forum_id == $forum_ids_moderator[0]) { $forum_unread = true; } diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index 6d5021b9aa..16dce16a72 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -476,8 +476,9 @@ class jabber } else if (in_array('PLAIN', $methods) && ($this->session['ssl'] || !empty($this->session['tls']))) { + // http://www.ietf.org/rfc/rfc4616.txt (PLAIN SASL Mechanism) $this->send("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>" - . base64_encode(chr(0) . $this->username . '@' . $this->server . chr(0) . $this->password) . + . base64_encode($this->username . '@' . $this->server . chr(0) . $this->username . chr(0) . $this->password) . '</auth>'); } else if (in_array('ANONYMOUS', $methods)) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 3df582d640..8979511d9a 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -115,7 +115,7 @@ class bbcode_firstpass extends bbcode 'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")), 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")), 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")), - 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\]((?s).*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")), + 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")), 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#iUe' => "\$this->bbcode_img('\$1')")), 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")), 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")), @@ -1064,17 +1064,12 @@ class parse_message extends bbcode_firstpass $this->mode = $mode; - if (!isset($config['max_' . $mode . '_chars'])) + foreach (array('chars', 'smilies', 'urls', 'font_size', 'img_height', 'img_width') as $key) { - $config['max_' . $mode . '_chars'] = 0; - } - if (!isset($config['max_' . $mode . '_smilies'])) - { - $config['max_' . $mode . '_smilies'] = 0; - } - if (!isset($config['max_' . $mode . '_urls'])) - { - $config['max_' . $mode . '_urls'] = 0; + if (!isset($config['max_' . $mode . '_' . $key])) + { + $config['max_' . $mode . '_' . $key] = 0; + } } $this->allow_img_bbcode = $allow_img_bbcode; diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 1d015576a7..659c088763 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -303,6 +303,7 @@ class phpbb_questionnaire_phpbb_data_provider 'database_gc' => true, 'dbms_version' => true, 'default_dateformat' => true, + 'default_lang' => true, 'display_last_edited' => true, 'display_order' => true, 'edit_time' => true, |