From af21e38c1d6f3fd738c97bd6cf0f96285c0b35aa Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 17 May 2010 08:54:51 +0200 Subject: [PATCH 01/57] [ticket/9611] Make length of activation keys variable between 6 and 10. PHPBB3-9611 --- phpBB/includes/acp/acp_users.php | 5 +---- phpBB/includes/ucp/ucp_profile.php | 5 +---- phpBB/includes/ucp/ucp_register.php | 6 +----- phpBB/includes/ucp/ucp_remind.php | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7914edd056..cc0f3d4cde 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -314,10 +314,7 @@ class acp_users $server_url = generate_board_url(); - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len > 6) ? $key_len : 6; - $user_actkey = substr($user_actkey, 0, $key_len); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; if ($user_row['user_type'] == USER_NORMAL) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f4f4abad4a..6b255e81a0 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -141,10 +141,7 @@ class ucp_profile $server_url = generate_board_url(); - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len > 6) ? $key_len : 6; - $user_actkey = substr($user_actkey, 0, $key_len); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $messenger = new messenger(false); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 9656a4a3af..7fd99da55a 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -286,11 +286,7 @@ class ucp_register $config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) { - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len < 6) ? 6 : $key_len; - $user_actkey = substr($user_actkey, 0, $key_len); - + $user_actkey = gen_rand_string(mt_rand(6, 10)); $user_type = USER_INACTIVE; $user_inactive_reason = INACTIVE_REGISTER; $user_inactive_time = time(); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index f9b792de20..0042cd9df7 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -82,7 +82,7 @@ class ucp_remind $user_password = gen_rand_string(max(8, rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); // For the activation key a random length between 6 and 10 will do. - $user_actkey = gen_rand_string(rand(6, 10)); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $sql = 'UPDATE ' . USERS_TABLE . " SET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "' From c2b29c317f2d3bf41ed737c9eb3d49bce41ec432 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 17 May 2010 09:40:32 +0200 Subject: [PATCH 02/57] [ticket/9612] Introduce new function gen_rand_string_friendly(). Introduce new function gen_rand_string_friendly() for user friendly random strings like passwords and captcha codes. Strings generated by gen_rand_string_friendly() will not contain the characters 0 and O. By adding a new function we can increase the entropy of strings generated by gen_rand_string() by putting 0 and O back in. PHPBB3-9612 --- .../captcha/plugins/captcha_abstract.php | 8 ++++---- phpBB/includes/functions.php | 17 +++++++++++++++++ phpBB/includes/ucp/ucp_remind.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index e7b8742b05..21cacd730c 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -59,7 +59,7 @@ class phpbb_default_captcha { global $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); // compute $seed % 0x7fffffff @@ -235,7 +235,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->confirm_id = md5(unique_id($user->ip)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; @@ -259,7 +259,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; // compute $seed % 0x7fffffff @@ -281,7 +281,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; // compute $seed % 0x7fffffff diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..2b5b8e6092 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -195,10 +195,27 @@ function set_config_count($config_name, $increment, $is_dynamic = false) /** * Generates an alphanumeric random string of given length +* +* @return string */ function gen_rand_string($num_chars = 8) +{ + // [a, z] + [0, 9] = 36 + return strtoupper(base_convert(unique_id(), 16, 36)); +} + +/** +* Generates a user-friendly alphanumeric random string of given length +* We remove 0 and O so users cannot confuse those in passwords etc. +* +* @return string +*/ +function gen_rand_string_friendly($num_chars = 8) { $rand_str = unique_id(); + + // Remove Z and Y from the base_convert(), replace 0 with Z and O with Y + // [a, z] + [0, 9] - {z, y} = [a, z] + [0, 9] - {0, o} = 34 $rand_str = str_replace(array('0', 'O'), array('Z', 'Y'), strtoupper(base_convert($rand_str, 16, 34))); return substr($rand_str, 0, $num_chars); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 0042cd9df7..cb89ad99be 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -79,7 +79,7 @@ class ucp_remind // Make password at least 8 characters long, make it longer if admin wants to. // gen_rand_string() however has a limit of 12 or 13. - $user_password = gen_rand_string(max(8, rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); + $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); // For the activation key a random length between 6 and 10 will do. $user_actkey = gen_rand_string(mt_rand(6, 10)); From 30891ffb465f9745a6cd3c05957226ef0e600d94 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 4 Apr 2010 16:34:29 +0200 Subject: [PATCH 03/57] [ticket/9167] Remove shadow topics from remaining forums when deleting a forum including posts. The function delete_topic_shadows() had to be reimplemented. It was there but it was completly broken and hasn't been used at all. PHPBB3-9167 --- phpBB/includes/acp/acp_forums.php | 3 + phpBB/includes/functions_admin.php | 88 +++++++++++++++++------------- 2 files changed, 53 insertions(+), 38 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6261f866bb..ef3be980a8 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1642,6 +1642,9 @@ class acp_forums delete_attachments('topic', $topic_ids, false); + // Delete shadow topics pointing to topics in this forum + delete_topic_shadows($forum_id); + // Before we remove anything we make sure we are able to adjust the post counts later. ;) $sql = 'SELECT poster_id FROM ' . POSTS_TABLE . ' diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 4cd2962e3b..7053640104 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1125,53 +1125,65 @@ function delete_attachments($mode, $ids, $resync = true) } /** -* Remove topic shadows +* Deletes shadow topics pointing to a specified forum. +* +* @param int $forum_id The forum id +* @param string $sql_more Additional WHERE statement, e.g. t.topic_time < (time() - 1234) +* @param bool $auto_sync Will call sync() if this is true +* +* @return array Array with affected forums +* +* @author bantu */ -function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true) +function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) { - $where = (is_array($forum_id)) ? 'AND ' . $db->sql_in_set('t.forum_id', array_map('intval', $forum_id)) : (($forum_id) ? 'AND t.forum_id = ' . (int) $forum_id : ''); + global $db; - switch ($db->sql_layer) + if (!$forum_id) { - case 'mysql4': - case 'mysqli': - $sql = 'DELETE t.* - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TABLE . ' t2 - WHERE t.topic_moved_id = t2.topic_id - AND t.topic_time < ' . (time() - $max_age) - . $where; - $db->sql_query($sql); - break; - - default: - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TABLE . ' t2 - WHERE t.topic_moved_id = t2.topic_id - AND t.topic_time < ' . (time() - $max_age) - . $where; - $result = $db->sql_query($sql); - - $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $topic_ids[] = $row['topic_id']; - } - $db->sql_freeresult($result); - - if (sizeof($topic_ids)) - { - $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); - } - break; + // Nothing to do. + return; } + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + // Amount of topics we select and delete at once. + $batch_size = 500; + + do + { + $sql = 'SELECT t2.forum_id, t2.topic_id + FROM ' . TOPICS_TABLE . ' t2, ' . TOPICS_TABLE . ' t + WHERE t2.topic_moved_id = t.topic_id + AND t.forum_id = ' . (int) $forum_id . ' + ' . (($sql_more) ? 'AND ' . $sql_more : ''); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (sizeof($topic_ids) == $batch_size); + if ($auto_sync) { - $where_type = ($forum_id) ? 'forum_id' : ''; - sync('forum', $where_type, $forum_id, true, true); + sync('forum', 'forum_id', $sync_forum_ids, true, true); } + + return $sync_forum_ids; } /** From 38fc35a497e375797afdce6bc3cba952b9ed5344 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 4 Apr 2010 18:50:23 +0200 Subject: [PATCH 04/57] [ticket/9167] Detect and remove any dead left over shadow topics on update. PHPBB3-9167 --- phpBB/install/database_update.php | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..7b27363125 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1684,6 +1684,51 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // Delete shadow topics pointing to not existing topics + $batch_size = 500; + + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + do + { + $sql_array = array( + 'SELECT' => 't1.topic_id, t1.forum_id', + 'FROM' => array( + TOPICS_TABLE => 't1', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't2'), + 'ON' => 't1.topic_moved_id = t2.topic_id', + ), + ), + 'WHERE' => 't1.topic_moved_id <> 0 + AND t2.topic_id IS NULL', + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (sizeof($topic_ids) == $batch_size); + + // Sync the forums we have deleted shadow topics from. + sync('forum', 'forum_id', $sync_forum_ids, true, true); $no_updates = false; break; From 38cc9ce72fd09423b53de5c78a0332fd7ee8eadf Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 28 Jun 2010 17:37:45 +0200 Subject: [PATCH 05/57] [task/set-permissions] shell script to set file permissions PHPBB3-9689 --- phpBB/develop/set_permissions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 phpBB/develop/set_permissions.sh diff --git a/phpBB/develop/set_permissions.sh b/phpBB/develop/set_permissions.sh new file mode 100755 index 0000000000..879b94e518 --- /dev/null +++ b/phpBB/develop/set_permissions.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# set permissions required for installation + +dir=$(dirname $0) + +for file in cache files store config.php images/avatars/upload +do + chmod a+w $dir/../$file +done From 32882fd798ae0fe7e51f5c7ef2ff8501a5b57251 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Jul 2010 23:29:25 +0200 Subject: [PATCH 06/57] [ticket/9694] Make sure string offset 0 exists to avoid E_NOTICE message. PHPBB3-9694 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2154847865..03a37a58b4 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -61,7 +61,7 @@ if (isset($_GET['avatar'])) $avatar_group = false; $exit = false; - if ($filename[0] === 'g') + if (isset($filename[0]) && $filename[0] === 'g') { $avatar_group = true; $filename = substr($filename, 1); From 881c74688bc41d83c00db8c96715dc48d06c9d3d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Jul 2010 23:30:48 +0200 Subject: [PATCH 07/57] [ticket/9694] Call error_reporting() in download/file.php when in avatar mode. PHPBB3-9694 --- phpBB/download/file.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 03a37a58b4..97f4ff3c8a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -31,6 +31,12 @@ else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT' if (isset($_GET['avatar'])) { + if (!defined('E_DEPRECATED')) + { + define('E_DEPRECATED', 8192); + } + error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); + require($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) From c6c4d01fe9619a1db585b7446343517762cd18b1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 8 Jul 2010 20:26:50 +0200 Subject: [PATCH 08/57] [ticket/9714] Use correct variable name in email regular expression tests. PHPBB3-9714 --- tests/regex/email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/regex/email.php b/tests/regex/email.php index b1519dfa5f..85b6406ffc 100644 --- a/tests/regex/email.php +++ b/tests/regex/email.php @@ -70,7 +70,7 @@ class phpbb_regex_email_test extends phpbb_test_case /** * @dataProvider negative_match_data */ - public function test_negative_match($address) + public function test_negative_match($email) { $this->assertEquals(0, preg_match($this->regex, $email)); } From bbc3105466ccd43d94423325a68c626c76dec5f9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 8 Jul 2010 22:44:28 +0200 Subject: [PATCH 09/57] [ticket/9701] Prevent notices from being hidden by template tests The template tests disable NOTICEs for the duration of template execution since the current version of the template engine does not generate sufficiently clean code. The error level is reset aftwards, however that part is skipped when trigger_error is called which is converted into a regular exception by PHPUnit and passed down until caught. Such exceptions are now caught to reset the error level, and then the exception is rethrown. This uncovered another issue in the template tests which only passed because NOTICEs were unintentionally disabled at this point. assign_display is also required to operate without NOTICEs. The respective code has been added around its callee as well. However no handling of exceptions takes place there. If another test checking for errors in that function is ever added similar catch logic will have to be added there. PHPBB3-9701 --- tests/template/template.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/template/template.php b/tests/template/template.php index 145fe8de61..024d3712f7 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -26,12 +26,24 @@ class phpbb_template_template_test extends phpbb_test_case error_reporting($error_level & ~E_NOTICE); ob_start(); - $this->assertTrue($this->template->display($handle, false)); + + try + { + $this->assertTrue($this->template->display($handle, false)); + } + catch (Exception $exception) + { + // reset the error level even when an error occured + // PHPUnit turns trigger_error into exceptions as well + error_reporting($error_level); + throw $exception; + } + + $result = self::trim_template_result(ob_get_clean()); // reset error level error_reporting($error_level); - - return self::trim_template_result(ob_get_clean()); + return $result; } private static function trim_template_result($result) @@ -368,9 +380,15 @@ class phpbb_template_template_test extends phpbb_test_case $this->template->destroy_block_vars($block); } + $error_level = error_reporting(); + error_reporting($error_level & ~E_NOTICE); + $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)"); $this->template->assign_display('test', 'VARIABLE', false); + + error_reporting($error_level); + $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); } From ed44235d26180c539eaf7af5e5b15c7fcb96ce45 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Jun 2010 21:07:38 +0200 Subject: [PATCH 10/57] [ticket/9534] Adding support for IPv6 addresses in user_ipwhois(). whois.arin.net does currently not refer to other servers (using ReferralServer) when queried for an IPv6 address. whois.sixxs.net however works in this case. This also adds '.' to the hostname to make sure we're querying the dns root. PHPBB3-9534 --- phpBB/includes/functions_user.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6f6d7526b7..c2ea8445d1 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1235,16 +1235,29 @@ function user_unban($mode, $ban) */ function user_ipwhois($ip) { - $ipwhois = ''; - - // Check IP - // Only supporting IPv4 at the moment... - if (empty($ip) || !preg_match(get_preg_expression('ipv4'), $ip)) + if (empty($ip)) { return ''; } - if (($fsk = @fsockopen('whois.arin.net', 43))) + if (preg_match(get_preg_expression('ipv4'), $ip)) + { + // IPv4 address + $whois_host = 'whois.arin.net.'; + } + else if (preg_match(get_preg_expression('ipv6'), $ip)) + { + // IPv6 address + $whois_host = 'whois.sixxs.net.'; + } + else + { + return ''; + } + + $ipwhois = ''; + + if (($fsk = @fsockopen($whois_host, 43))) { // CRLF as per RFC3912 fputs($fsk, "$ip\r\n"); @@ -1257,7 +1270,7 @@ function user_ipwhois($ip) $match = array(); - // Test for referrals from ARIN to other whois databases, roll on rwhois + // Test for referrals from $whois_host to other whois databases, roll on rwhois if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match)) { if (strpos($match[1], ':') !== false) @@ -1285,7 +1298,7 @@ function user_ipwhois($ip) @fclose($fsk); } - // Use the result from ARIN if we don't get any result here + // Use the result from $whois_host if we don't get any result here $ipwhois = (empty($buffer)) ? $ipwhois : $buffer; } From c0183cabd09994839170238fd5e2a87f1b48880b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Jun 2010 21:25:43 +0200 Subject: [PATCH 11/57] [ticket/9534] Update function documentation for user_ipwhois(). PHPBB3-9534 --- phpBB/includes/functions_user.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c2ea8445d1..467668d3ee 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1229,9 +1229,13 @@ function user_unban($mode, $ban) } /** -* Whois facility +* Internet Protocol Address Whois +* RFC3912: WHOIS Protocol Specification * -* @link http://tools.ietf.org/html/rfc3912 RFC3912: WHOIS Protocol Specification +* @param string $ip Ip address, either IPv4 or IPv6. +* +* @return string Empty string if not a valid ip address. +* Otherwise make_clickable()'ed whois result. */ function user_ipwhois($ip) { From a0b9f7806a6c3b08dd2c7e9cccfc7f742e42be1d Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 11 Jul 2010 15:18:21 -0700 Subject: [PATCH 12/57] [ticket/9715] Extend email unit tests Adding more email tests for a wider range of valid email formats. PHPBB3-9715 --- tests/regex/email.php | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/regex/email.php b/tests/regex/email.php index b1519dfa5f..8658b8af36 100644 --- a/tests/regex/email.php +++ b/tests/regex/email.php @@ -33,6 +33,27 @@ class phpbb_regex_email_test extends phpbb_test_case //array('"John Doe"@example.com'), //array('Alice@[192.168.2.1]'), // IPv4 //array('Bob@[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]'), // IPv6 + + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + array('l3tt3rsAndNumb3rs@domain.com'), + array('has-dash@domain.com'), + array('hasApostrophe.o\'leary@domain.org'), + array('uncommonTLD@domain.museum'), + array('uncommonTLD@domain.travel'), + array('uncommonTLD@domain.mobi'), + array('countryCodeTLD@domain.uk'), + array('countryCodeTLD@domain.rw'), + array('numbersInDomain@911.com'), + array('underscore_inLocal@domain.net'), + array('IPInsteadOfDomain@127.0.0.1'), + array('IPAndPort@127.0.0.1:25'), + array('subdomain@sub.domain.com'), + array('local@dash-inDomain.com'), + array('dot.inLocal@foo.com'), + array('a@singleLetterLocal.org'), + array('singleLetterDomain@x.org'), + array('&*=?^+{}\'~@validCharsInLocal.net'), + array('foor@bar.newTLD'), ); } @@ -56,6 +77,26 @@ class phpbb_regex_email_test extends phpbb_test_case array('abc,def@example.com'), // invalid character , array('abcdef@example.com'), // invalid character > + + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + array('missingDomain@.com'), + array('@missingLocal.org'), + array('missingatSign.net'), + array('missingDot@com'), + array('two@@signs.com'), + array('colonButNoPort@127.0.0.1:'), + array(''), + array('someone-else@127.0.0.1.26'), + array('.localStartsWithDot@domain.com'), + array('localEndsWithDot.@domain.com'), + array('two..consecutiveDots@domain.com'), + array('domainStartsWithDash@-domain.com'), + array('domainEndsWithDash@domain-.com'), + array('numbersInTLD@domain.c0m'), + array('missingTLD@domain.'), + array('! "#$%(),/;<>[]`|@invalidCharsInLocal.org'), + array('invalidCharsInDomain@! "#$%(),/;<>_[]`|.org'), + array('local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org'), ); } @@ -70,7 +111,7 @@ class phpbb_regex_email_test extends phpbb_test_case /** * @dataProvider negative_match_data */ - public function test_negative_match($address) + public function test_negative_match($email) { $this->assertEquals(0, preg_match($this->regex, $email)); } From 593e193bdc7bab20ec8460348b2fe597355dccda Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 11 Jul 2010 15:35:31 -0700 Subject: [PATCH 13/57] [ticket/9715] Better email regex Using email regex created by James Watts and Francisco Jose Martin Moreno. This passes many more tests for RFC valid emails. PHPBB3-9715 --- phpBB/includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9c74a524ee..bc3d721de5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3355,7 +3355,9 @@ function get_preg_expression($mode) switch ($mode) { case 'email': - return '(?:[a-z0-9\'\.\-_\+\|]++|&)+@[a-z0-9\-]+\.(?:[a-z0-9\-]+\.)*[a-z]+'; + // Regex written by James Watts and Francisco Jose Martin Moreno + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + return '([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; break; case 'bbcode_htm': From 2ba6360e439386a8e56d93a88ecaefb3c0f5904c Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Tue, 6 Jul 2010 12:03:02 +0200 Subject: [PATCH 14/57] [ticket/9140] Check current board version in incremental update packages Since we do not want to limit the updater functionality we only display a prominent warning when the current board version does not match the version the update files are meant to update from. PHPBB3-9140 --- phpBB/install/install_update.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index e717fe3dd4..6184cbbc33 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -192,6 +192,17 @@ class install_update extends module return; } + // Check if the update files are actually meant to update from the current version + if ($config['version'] != $this->update_info['version']['from']) + { + $this->unequal_version = true; + + $template->assign_vars(array( + 'S_ERROR' => true, + 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to']), + )); + } + // Check if the update files stored are for the latest version... if ($this->latest_version != $this->update_info['version']['to']) { From f0509e4620643549caa7a486d54b12d53617ab94 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 22 Jun 2010 14:42:02 +0200 Subject: [PATCH 15/57] [task/git-tools] append ticket id to git log message PHPBB3-9770 --- git-tools/hooks/prepare-commit-msg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 033cb187c7..ab01f49b5a 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -32,3 +32,10 @@ if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi + +if (echo $branch | grep '^ticket/') +then + ticket_id="$(echo $branch | sed "s/ticket\///g")" + echo >> "$1" + echo "PHPBB3-$ticket_id" >> "$1" +fi From 6b2f4b6a850493fa0277ae38ee816d7c5a3a2311 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 22 Jun 2010 16:42:29 +0200 Subject: [PATCH 16/57] [task/git-tools] move ticket id appending to commit-msg hook PHPBB3-9770 --- git-tools/hooks/commit-msg | 24 ++++++++++++++++++++++++ git-tools/hooks/prepare-commit-msg | 7 ------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg new file mode 100755 index 0000000000..db31d93698 --- /dev/null +++ b/git-tools/hooks/commit-msg @@ -0,0 +1,24 @@ +#!/bin/sh +# +# A hook to append PHPBB3- to ticket/ +# branches. +# +# This is a commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/commit-msg \\ +# .git/hooks/commit-msg + +if grep '^\[ticket/' "$1" +then + # get branch name + branch="$(git symbolic-ref HEAD)" + + # strip off refs/heads/ticket + ticket_id="$(echo "$branch" | sed "s/refs\/heads\/ticket\///g")" + + echo >> "$1" + echo "PHPBB3-$ticket_id" >> "$1" +fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index ab01f49b5a..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -32,10 +32,3 @@ if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi - -if (echo $branch | grep '^ticket/') -then - ticket_id="$(echo $branch | sed "s/ticket\///g")" - echo >> "$1" - echo "PHPBB3-$ticket_id" >> "$1" -fi From 14e5da90c3d84cb089e1df4d7a0ac7a34a0fbeba Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 26 Jun 2010 13:38:50 +0200 Subject: [PATCH 17/57] [task/git-tools] add install and uninstall scripts for hooks PHPBB3-9769 --- git-tools/hooks/install | 17 +++++++++++++++++ git-tools/hooks/uninstall | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 git-tools/hooks/install create mode 100755 git-tools/hooks/uninstall diff --git a/git-tools/hooks/install b/git-tools/hooks/install new file mode 100755 index 0000000000..a42c55a769 --- /dev/null +++ b/git-tools/hooks/install @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Script to install the git hooks +# by symlinking them into the .git/hooks directory +# +# Usage (from within git-tools/hooks): +# ./install + +dir=$(dirname $0) + +for file in $(ls $dir) +do + if [ $file != "install" ] && [ $file != "uninstall" ] + then + ln -s "../../git-tools/hooks/$file" "$dir/../../.git/hooks/$file" + fi +done diff --git a/git-tools/hooks/uninstall b/git-tools/hooks/uninstall new file mode 100755 index 0000000000..1b3b7fd2c9 --- /dev/null +++ b/git-tools/hooks/uninstall @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Script to uninstall the git hooks +# +# Usage (from within git-tools/hooks): +# ./uninstall + +dir=$(dirname $0) + +for file in $(ls $dir) +do + if [ $file != "install" ] && [ $file != "uninstall" ] + then + rm -f "$dir/../../.git/hooks/$file" + fi +done From 54713dcdc7abc897fa16209c837c2181eb89ad9c Mon Sep 17 00:00:00 2001 From: Patrick W Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 18/57] [ticket/9761] Reworded quote nesting depth ACP option to match the behaviour The nesting depth applies per quote block, not per post which the previous label and description indicated. PHPBB3-9761 --- phpBB/language/en/acp/board.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8b12a926b0..ac0ddf1b73 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -177,8 +177,8 @@ $lang = array_merge($lang, array( 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message.', 'POSTING' => 'Posting', 'POSTS_PER_PAGE' => 'Posts per page', - 'QUOTE_DEPTH_LIMIT' => 'Maximum nested quotes per post', - 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum number of nested quotes in a post. Set to 0 for unlimited depth.', + 'QUOTE_DEPTH_LIMIT' => 'Maximum nesting depth for quotes', + 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum quote nesting depth in a post. Set to 0 for unlimited depth.', 'SMILIES_LIMIT' => 'Maximum smilies per post', 'SMILIES_LIMIT_EXPLAIN' => 'Maximum number of smilies in a post. Set to 0 for unlimited smilies.', 'SMILIES_PER_PAGE' => 'Smilies per page', From 954b3c348454ee41eb8da189794ac34ffdd4a115 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 2 Jul 2010 09:08:46 +0200 Subject: [PATCH 19/57] [ticket/7720] Fix alternative image-description for unread posts. Changed the wrong word "new" to "unread" as that is, what we show with the red-icons, not whether the post is new or not. Language variables were kept for backwards compatibility. PHPBB3-7720 --- phpBB/includes/functions_display.php | 6 +-- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/mcp/mcp_queue.php | 2 +- phpBB/includes/mcp/mcp_reports.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 2 +- phpBB/includes/ucp/ucp_main.php | 4 +- phpBB/index.php | 8 ++-- phpBB/language/en/acp/styles.php | 44 +++++++++---------- phpBB/language/en/common.php | 9 ++-- phpBB/language/en/viewforum.php | 13 ++++-- .../subsilver2/template/index_body.html | 6 +-- .../subsilver2/template/viewforum_body.html | 18 ++++---- phpBB/viewforum.php | 16 +++---- phpBB/viewtopic.php | 2 +- 14 files changed, 71 insertions(+), 63 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 5e6239b070..2de7e1b169 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -396,7 +396,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { - $folder_alt = ($forum_unread) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + $folder_alt = ($forum_unread) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; } // Create last post link information, if appropriate @@ -425,7 +425,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $s_subforums_list = array(); foreach ($subforums_list as $subforum) { - $s_subforums_list[] = '' . $subforum['name'] . ''; + $s_subforums_list[] = '' . $subforum['name'] . ''; } $s_subforums_list = (string) implode(', ', $s_subforums_list); $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; @@ -854,7 +854,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold $folder_img = ($unread_topic) ? $folder_new : $folder; - $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); // Posted image? if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted']) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index fa44e006dd..1fbedbac4f 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -200,7 +200,7 @@ function mcp_post_details($id, $mode, $action) 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '", ''), 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '', ''), diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 8d9ece5205..f84a8c5f07 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -196,7 +196,7 @@ class mcp_queue 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index e19fe96963..39d9fbd4af 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -205,7 +205,7 @@ class mcp_reports 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '', ''), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 9779478330..76cd9beb92 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -237,7 +237,7 @@ function mcp_topic_view($id, $mode, $action) 'POST_ID' => $row['post_id'], 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => ($row['post_reported']) ? true : false, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 6ac2412ef0..a6f71669ce 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -119,7 +119,7 @@ class ucp_main $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; $folder_img = ($unread_topic) ? $folder_new : $folder; - $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); if ($row['topic_status'] == ITEM_LOCKED) { @@ -318,7 +318,7 @@ class ucp_main else { $folder_image = ($unread_forum) ? 'forum_unread' : 'forum_read'; - $folder_alt = ($unread_forum) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + $folder_alt = ($unread_forum) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; } // Create last post link information, if appropriate diff --git a/phpBB/index.php b/phpBB/index.php index c3dbbd346e..cc83641acd 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -115,10 +115,10 @@ $template->assign_vars(array( 'LEGEND' => $legend, 'BIRTHDAY_LIST' => $birthday_list, - 'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'), - 'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'), - 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'), - 'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'), + 'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'), + 'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'), + 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'), 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 247d8a4140..951c69f915 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -165,11 +165,11 @@ $lang = array_merge($lang, array( 'IMG_FORUM_READ' => 'Forum', 'IMG_FORUM_READ_LOCKED' => 'Forum locked', 'IMG_FORUM_READ_SUBFORUM' => 'Subforum', - 'IMG_FORUM_UNREAD' => 'Forum new posts', - 'IMG_FORUM_UNREAD_LOCKED' => 'Forum new posts locked', - 'IMG_FORUM_UNREAD_SUBFORUM' => 'Subforum new posts', + 'IMG_FORUM_UNREAD' => 'Forum unread posts', + 'IMG_FORUM_UNREAD_LOCKED' => 'Forum unread posts locked', + 'IMG_FORUM_UNREAD_SUBFORUM' => 'Subforum unread posts', 'IMG_SUBFORUM_READ' => 'Legend subforum', - 'IMG_SUBFORUM_UNREAD' => 'Legend subforum new posts', + 'IMG_SUBFORUM_UNREAD' => 'Legend subforum unread posts', 'IMG_TOPIC_MOVED' => 'Topic moved', @@ -180,39 +180,39 @@ $lang = array_merge($lang, array( 'IMG_TOPIC_READ_LOCKED' => 'Topic locked', 'IMG_TOPIC_READ_LOCKED_MINE' => 'Topic locked posted to', - 'IMG_TOPIC_UNREAD' => 'Topic new posts', - 'IMG_TOPIC_UNREAD_MINE' => 'Topic posted to new', - 'IMG_TOPIC_UNREAD_HOT' => 'Topic popular new posts', - 'IMG_TOPIC_UNREAD_HOT_MINE' => 'Topic popular posted to new', - 'IMG_TOPIC_UNREAD_LOCKED' => 'Topic locked new', - 'IMG_TOPIC_UNREAD_LOCKED_MINE' => 'Topic locked posted to new', + 'IMG_TOPIC_UNREAD' => 'Topic unread posts', + 'IMG_TOPIC_UNREAD_MINE' => 'Topic posted to unread', + 'IMG_TOPIC_UNREAD_HOT' => 'Topic popular unread posts', + 'IMG_TOPIC_UNREAD_HOT_MINE' => 'Topic popular posted to unread', + 'IMG_TOPIC_UNREAD_LOCKED' => 'Topic locked unread', + 'IMG_TOPIC_UNREAD_LOCKED_MINE' => 'Topic locked posted to unread', 'IMG_STICKY_READ' => 'Sticky topic', 'IMG_STICKY_READ_MINE' => 'Sticky topic posted to', 'IMG_STICKY_READ_LOCKED' => 'Sticky topic locked', 'IMG_STICKY_READ_LOCKED_MINE' => 'Sticky topic locked posted to', - 'IMG_STICKY_UNREAD' => 'Sticky topic new posts', - 'IMG_STICKY_UNREAD_MINE' => 'Sticky topic posted to new', - 'IMG_STICKY_UNREAD_LOCKED' => 'Sticky topic locked new posts', - 'IMG_STICKY_UNREAD_LOCKED_MINE' => 'Sticky topic locked posted to new', + 'IMG_STICKY_UNREAD' => 'Sticky topic unread posts', + 'IMG_STICKY_UNREAD_MINE' => 'Sticky topic posted to unread', + 'IMG_STICKY_UNREAD_LOCKED' => 'Sticky topic locked unread posts', + 'IMG_STICKY_UNREAD_LOCKED_MINE' => 'Sticky topic locked posted to unread', 'IMG_ANNOUNCE_READ' => 'Announcement', 'IMG_ANNOUNCE_READ_MINE' => 'Announcement posted to', 'IMG_ANNOUNCE_READ_LOCKED' => 'Announcement locked', 'IMG_ANNOUNCE_READ_LOCKED_MINE' => 'Announcement locked posted to', - 'IMG_ANNOUNCE_UNREAD' => 'Announcement new posts', - 'IMG_ANNOUNCE_UNREAD_MINE' => 'Announcement posted to new', - 'IMG_ANNOUNCE_UNREAD_LOCKED' => 'Announcement locked new posts', - 'IMG_ANNOUNCE_UNREAD_LOCKED_MINE' => 'Announcement locked posted to new', + 'IMG_ANNOUNCE_UNREAD' => 'Announcement unread posts', + 'IMG_ANNOUNCE_UNREAD_MINE' => 'Announcement posted to unread', + 'IMG_ANNOUNCE_UNREAD_LOCKED' => 'Announcement locked unread posts', + 'IMG_ANNOUNCE_UNREAD_LOCKED_MINE' => 'Announcement locked posted to unread', 'IMG_GLOBAL_READ' => 'Global', 'IMG_GLOBAL_READ_MINE' => 'Global posted to', 'IMG_GLOBAL_READ_LOCKED' => 'Global locked', 'IMG_GLOBAL_READ_LOCKED_MINE' => 'Global locked posted to', - 'IMG_GLOBAL_UNREAD' => 'Global new posts', - 'IMG_GLOBAL_UNREAD_MINE' => 'Global posted to new', - 'IMG_GLOBAL_UNREAD_LOCKED' => 'Global locked new posts', - 'IMG_GLOBAL_UNREAD_LOCKED_MINE' => 'Global locked posted to new', + 'IMG_GLOBAL_UNREAD' => 'Global unread posts', + 'IMG_GLOBAL_UNREAD_MINE' => 'Global posted to unread', + 'IMG_GLOBAL_UNREAD_LOCKED' => 'Global locked unread posts', + 'IMG_GLOBAL_UNREAD_LOCKED_MINE' => 'Global locked posted to unread', 'IMG_PM_READ' => 'Read private message', 'IMG_PM_UNREAD' => 'Unread private message', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 03986c0361..bc38c1563d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -347,8 +347,8 @@ $lang = array_merge($lang, array( 'NEW_MESSAGES' => 'New messages', 'NEW_PM' => '%d new message', 'NEW_PMS' => '%d new messages', - 'NEW_POST' => 'New post', - 'NEW_POSTS' => 'New posts', + 'NEW_POST' => 'New post', // Not used anymore + 'NEW_POSTS' => 'New posts', // Not used anymore 'NEXT' => 'Next', // Used in pagination 'NEXT_STEP' => 'Next', 'NEVER' => 'Never', @@ -381,7 +381,7 @@ $lang = array_merge($lang, array( 'NO_MODERATORS' => 'There are no moderators.', 'NO_NEW_MESSAGES' => 'No new messages', 'NO_NEW_PM' => '0 new messages', - 'NO_NEW_POSTS' => 'No new posts', + 'NO_NEW_POSTS' => 'No new posts', // Not used anymore 'NO_ONLINE_USERS' => 'No registered users', 'NO_POSTS' => 'No posts', 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', @@ -395,6 +395,7 @@ $lang = array_merge($lang, array( 'NO_TOPICS' => 'There are no topics or posts in this forum.', 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', 'NO_UNREAD_PM' => '0 unread messages', + 'NO_UNREAD_POSTS' => 'No unread posts', 'NO_UPLOAD_FORM_FOUND' => 'Upload initiated but no valid file upload form found.', 'NO_USER' => 'The requested user does not exist.', 'NO_USERS' => 'The requested users do not exist.', @@ -641,6 +642,8 @@ $lang = array_merge($lang, array( 'UNREAD_MESSAGES' => 'Unread messages', 'UNREAD_PM' => '%d unread message', 'UNREAD_PMS' => '%d unread messages', + 'UNREAD_POST' => 'Unread post', + 'UNREAD_POSTS' => 'Unread posts', 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', 'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.', diff --git a/phpBB/language/en/viewforum.php b/phpBB/language/en/viewforum.php index 546f91587d..d2fae20c62 100644 --- a/phpBB/language/en/viewforum.php +++ b/phpBB/language/en/viewforum.php @@ -48,16 +48,21 @@ $lang = array_merge($lang, array( 'MARK_TOPICS_READ' => 'Mark topics read', - 'NEW_POSTS_HOT' => 'New posts [ Popular ]', - 'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', - 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', - 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', + 'NEW_POSTS_HOT' => 'New posts [ Popular ]', // Not used anymore + 'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', // Not used anymore + 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', // Not used anymore + 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', // Not used anymore 'NO_READ_ACCESS' => 'You do not have the required permissions to read topics within this forum.', + 'NO_UNREAD_POSTS_HOT' => 'No unread posts [ Popular ]', + 'NO_UNREAD_POSTS_LOCKED' => 'No unread posts [ Locked ]', 'POST_FORUM_LOCKED' => 'Forum is locked', 'TOPICS_MARKED' => 'The topics for this forum have now been marked read.', + 'UNREAD_POSTS_HOT' => 'Unread posts [ Popular ]', + 'UNREAD_POSTS_LOCKED' => 'Unread posts [ Locked ]', + 'VIEW_FORUM' => 'View forum', 'VIEW_FORUM_TOPIC' => '1 topic', 'VIEW_FORUM_TOPICS' => '%d topics', diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html index 863e4f7bee..8faf76e9ee 100644 --- a/phpBB/styles/subsilver2/template/index_body.html +++ b/phpBB/styles/subsilver2/template/index_body.html @@ -89,11 +89,11 @@ - - + + - + diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index 387a749e24..6511fa5349 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -281,31 +281,31 @@
{FORUM_NEW_IMG}{L_NEW_POSTS}{FORUM_UNREAD_IMG}{L_UNREAD_POSTS}    {FORUM_IMG}{L_NO_NEW_POSTS}{L_NO_UNREAD_POSTS}    {FORUM_LOCKED_IMG} {L_FORUM_LOCKED} - - + + - + - - + + - + - - + + - + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d18508ccbc..ee098c9f4a 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -273,16 +273,16 @@ $template->assign_vars(array( 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt), 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'), - 'FOLDER_NEW_IMG' => $user->img('topic_unread', 'NEW_POSTS'), - 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'), - 'FOLDER_HOT_NEW_IMG' => $user->img('topic_unread_hot', 'NEW_POSTS_HOT'), - 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'), - 'FOLDER_LOCKED_NEW_IMG' => $user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'), + 'FOLDER_IMG' => $user->img('topic_read', 'NO_UNREAD_POSTS'), + 'FOLDER_UNREAD_IMG' => $user->img('topic_unread', 'UNREAD_POSTS'), + 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_UNREAD_POSTS_HOT'), + 'FOLDER_HOT_UNREAD_IMG' => $user->img('topic_unread_hot', 'UNREAD_POSTS_HOT'), + 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FOLDER_LOCKED_UNREAD_IMG' => $user->img('topic_unread_locked', 'UNREAD_POSTS_LOCKED'), 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'), - 'FOLDER_STICKY_NEW_IMG' => $user->img('sticky_unread', 'POST_STICKY'), + 'FOLDER_STICKY_UNREAD_IMG' => $user->img('sticky_unread', 'POST_STICKY'), 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'), - 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('announce_unread', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_UNREAD_IMG'=> $user->img('announce_unread', 'POST_ANNOUNCEMENT'), 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8e0521522d..8926d5a40b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1513,7 +1513,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'EDIT_REASON' => $row['post_edit_reason'], 'BUMPED_MESSAGE' => $l_bumped_by, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', From 8690d25b4fab47853bcab46fc07ee577569c6822 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 2 Jul 2010 13:41:52 +0200 Subject: [PATCH 20/57] [ticket/9504] Allow whitespaces in gallery avatars Gallery avatars are discovered on the server filesystem; to allow linking to the images, the filenames are urlencoded before being written to the database. However, getimagesize needs the decoded filename as input. PHPBB3-9504 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..f58e19ddbe 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2348,7 +2348,7 @@ function avatar_process_user(&$error, $custom_userdata = false) } else { - list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); + list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . urldecode($sql_ary['user_avatar'])); $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar']; } } From 1363ee109ba5e8fece57b296d745f8488f1c79d0 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 15 Jul 2010 20:34:12 +0800 Subject: [PATCH 21/57] [ticket/9658] Optimize topic splitting. Split topics takes too long in some cases because of wrong variables or arrays values types adjustment. Cast values representing topic and forum ids as int. PHPBB3-9658 --- phpBB/includes/functions_admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 4cd2962e3b..89892feb30 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -573,8 +573,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) while ($row = $db->sql_fetchrow($result)) { - $forum_ids[] = $row['forum_id']; - $topic_ids[] = $row['topic_id']; + $forum_ids[] = (int) $row['forum_id']; + $topic_ids[] = (int) $row['topic_id']; } $db->sql_freeresult($result); @@ -591,7 +591,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) } $sql = 'UPDATE ' . POSTS_TABLE . ' - SET forum_id = ' . $forum_row['forum_id'] . ", topic_id = $topic_id + SET forum_id = ' . (int) $forum_row['forum_id'] . ", topic_id = $topic_id WHERE " . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); @@ -602,7 +602,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) if ($auto_sync) { - $forum_ids[] = $forum_row['forum_id']; + $forum_ids[] = (int) $forum_row['forum_id']; sync('topic_reported', 'topic_id', $topic_ids); sync('topic_attachment', 'topic_id', $topic_ids); From 16c95b4f8394e65faa34380640c892b1f99be1ed Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 18 Jul 2010 11:51:13 -0500 Subject: [PATCH 22/57] [ticket/9727] Smiley Path replacement in feeds is too generic The smiley path replacement in the feeds was too broad: any post content containing "./" was changed to the fully qualified board URL. This broke CSS for example. PHPBB3-9727 --- phpBB/feed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 88c30c5d4f..c4b71f3a26 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -276,8 +276,8 @@ function feed_generate_content($content, $uid, $bitfield, $options) // Add newlines $content = str_replace('
', '
' . "\n", $content); - // Relative Path to Absolute path, Windows style - $content = str_replace('./', $board_url . '/', $content); + // Convert smiley Relative paths to Absolute path, Windows style + $content = str_replace($phpbb_root_path . $config['smilies_path'], $board_url . '/' . $config['smilies_path'], $content); // Remove "Select all" link and mouse events $content = str_replace('' . $user->lang['SELECT_ALL_CODE'] . '', '', $content); From 875fcda506563d41a53f1d1ec3530662df975b81 Mon Sep 17 00:00:00 2001 From: Tabitha Backoff Date: Mon, 26 Apr 2010 07:45:31 -0400 Subject: [PATCH 23/57] [ticket/9099] Add missing commas in acp language. PHPBB3-9099 --- phpBB/language/en/acp/board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 80db81653d..ce0b81530d 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -393,7 +393,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_EMAIL' => 'The specified e-mail attribute does not exist.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_PASSWORD' => 'LDAP password', - 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'LDAP_PORT' => 'LDAP server port', 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', 'LDAP_SERVER' => 'LDAP server name', @@ -505,7 +505,7 @@ $lang = array_merge($lang, array( 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', 'SMTP_LOGIN' => 'LOGIN', 'SMTP_PASSWORD' => 'SMTP password', - 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'SMTP_PLAIN' => 'PLAIN', 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', @@ -528,7 +528,7 @@ $lang = array_merge($lang, array( 'JAB_PACKAGE_SIZE' => 'Jabber package size', 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', 'JAB_PASSWORD' => 'Jabber password', - 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'JAB_PORT' => 'Jabber port', 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', 'JAB_SERVER' => 'Jabber server', From 72dddf3aa3f900a5623410ffb4e44295251c4754 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 22 Jul 2010 00:31:13 +0200 Subject: [PATCH 24/57] [ticket/9744] Fix mistyped word 'then' in FAQ. It should be 'than'. PHPBB3-9744 --- phpBB/language/en/help_faq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index c76c281df5..3b7dc02d3f 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -128,7 +128,7 @@ $help = array( ), array( 0 => 'Why can’t I add more poll options?', - 1 => 'The limit for poll options is set by the board administrator. If you feel you need to add more options to your poll then the allowed amount, contact the board administrator.' + 1 => 'The limit for poll options is set by the board administrator. If you feel you need to add more options to your poll than the allowed amount, contact the board administrator.' ), array( 0 => 'How do I edit or delete a poll?', From afff4f79232233a4c6d3a5bcca6946bf9b92d0db Mon Sep 17 00:00:00 2001 From: Nick Anderegg Date: Wed, 28 Apr 2010 17:05:12 -0400 Subject: [PATCH 25/57] [ticket/9068] Added a missing comma in acp load settings explanation text. PHPBB3-9068 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 80db81653d..91ee422a58 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -360,7 +360,7 @@ $lang = array_merge($lang, array( 'RECOMPILE_STYLES' => 'Recompile stale style components', 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', - 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled posts are always read for guests.', + 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', 'YES_BIRTHDAYS' => 'Enable birthday listing', 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', 'YES_JUMPBOX' => 'Enable display of jumpbox', From c284ffade9bce9da06f8d4bc0d2344c09d2d6223 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Wed, 21 Jul 2010 22:42:44 -0500 Subject: [PATCH 26/57] [ticket/9722] Adjust "New Topic" title attribute for consistency in prosilver Title attribute was being applied to a
at the top of the page and to an at the bottom of the page. Now both being applied to the
. PHPBB3-9722 --- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 309375c269..12073a39d2 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -39,7 +39,7 @@ From 2f312b2175fd0ff13cb18d499b01a7092a2ad4d4 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 22 Jul 2010 10:44:31 -0500 Subject: [PATCH 27/57] [ticket/9559] Do not override queue package size in the case of an overflow This reverts r8025 to includes/functions_messenger.php. That code caused problems on hosters with email limits less than package_size*2.5. And it isn't desirable in general to over-ride the admin's configuration options. PHPBB3-9559 --- phpBB/includes/functions_messenger.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 99883cd9ca..bb0d88ec1b 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -671,11 +671,18 @@ class queue $package_size = $data_ary['package_size']; $num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size; + /* + * This code is commented out because it causes problems on some web hosts. + * The core problem is rather restrictive email sending limits. + * This code is nly useful if you have no such restrictions from the + * web host and the package size setting is wrong. + // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... if (sizeof($data_ary['data']) > $package_size * 2.5) { $num_items = sizeof($data_ary['data']); } + */ switch ($object) { From aca0e024faeca67ba5927b9f9ec495d5f687850d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 18:39:12 +0200 Subject: [PATCH 28/57] [ticket/9702] Take user's timezone settings into account when banning Until -> PHPBB3-9702 --- phpBB/includes/functions_user.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b26f28864..d9c7d1f2aa 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -766,7 +766,8 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) && (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) { - $ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0])); + $time_offset = (isset($user->timezone) && isset($user->dst)) ? (int) $user->timezone + (int) $user->dst : 0; + $ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0]) - $time_offset); } else { From 4d0a53b5ee88b9a5a810eb3bcb5cee35659ee5aa Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 25 Jul 2010 16:57:00 +0800 Subject: [PATCH 29/57] [ticket/9747] Improve word censor. Better handling of the asterisk inside censor pattern like 'bad*word' etc. PHPBB3-9747 --- phpBB/includes/cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index 6b1e078ca4..b50fab4ca2 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -88,7 +88,14 @@ class cache extends acm { if ($unicode) { - $censors['match'][] = '#(? Date: Mon, 26 Jul 2010 13:25:13 -0500 Subject: [PATCH 30/57] [ticket/9499] Unify definition of dE() and other javascript functions dE() was defined differently in the ACP and in prosilver. Other javascript in editor.js files has also been unified (taking the prosilver implementation as cannonical) PHPBB3-9499 --- phpBB/adm/style/editor.js | 15 ++++++++++----- phpBB/styles/prosilver/template/forum_fn.js | 13 +++++++++---- phpBB/styles/subsilver2/template/editor.js | 5 +++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 7e3ce1c708..217aa699e2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -46,7 +46,11 @@ function initInsertions() { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; - // document.body.focus(); + + if (!document.forms[form_name]) + { + document.body.focus(); + } } } @@ -230,6 +234,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -273,8 +278,8 @@ function mozWrap(txtarea, open, close) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; - txtarea.selectionStart = selEnd + open.length + close.length; - txtarea.selectionEnd = txtarea.selectionStart; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; txtarea.focus(); txtarea.scrollTop = scrollTop; @@ -327,8 +332,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write('
'); } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 6fb3778952..4a85858df5 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -98,16 +98,21 @@ function viewableArea(e, itself) /** * Set display of page element * s[-1,0,1] = hide,toggle display,show +* type = string: inline, block, inline-block or other CSS "display" type */ -function dE(n, s) +function dE(n, s, type) { - var e = document.getElementById(n); + if (!type) + { + type = 'block'; + } + var e = document.getElementById(n); if (!s) { - s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1; + s = (e.style.display == '' || e.style.display == type) ? -1 : 1; } - e.style.display = (s == 1) ? 'block' : 'none'; + e.style.display = (s == 1) ? type : 'none'; } /** diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index e340bc74b5..cd22812bab 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -240,6 +240,7 @@ function addquote(post_id, username, l_wrote) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -387,8 +388,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write(''); } From 8ea0309ed1e72023cab9daef407005511e99ac14 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 10:01:35 -0500 Subject: [PATCH 31/57] [ticket/9679] phpBB offers to notify poster even if notification is disabled The "notify user" check box would not do anything if checked in this case, but it was still presented. The checkbox is now only shown if there are notification options enabled. PHPBB3-9679 --- phpBB/includes/mcp/mcp_queue.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f84a8c5f07..e43881fab2 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -691,16 +691,19 @@ function approve_post($post_id_list, $id, $mode) { $show_notify = false; - foreach ($post_info as $post_data) + if ($config['email_enable'] || $config['jab_enable']) { - if ($post_data['poster_id'] == ANONYMOUS) + foreach ($post_info as $post_data) { - continue; - } - else - { - $show_notify = true; - break; + if ($post_data['poster_id'] == ANONYMOUS) + { + continue; + } + else + { + $show_notify = true; + break; + } } } From ac56b71c3ede46ab839ff77a0b324ef746d90cb0 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 10:13:17 -0500 Subject: [PATCH 32/57] [ticket/9749] Fulltext mysql unexpected behavior on entering a dash in query The Fulltext_mysql class had different behavior when a dash was entered in the search query than the fulltext_native class. Specifically, a dash was automatically turned into boolean NOT even when the user wanted to search for legitimate hyphenated words like farty-pants PHPBB3-9749 --- phpBB/includes/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index da3833754e..0be3a10e5f 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -122,7 +122,7 @@ class fulltext_mysql extends search_backend if ($terms == 'all') { - $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#'); + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); $keywords = preg_replace($match, $replace, $keywords); From 15d7010d4605a5f8d0082299a904ed54ad002618 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 13:19:19 -0500 Subject: [PATCH 33/57] [ticket/9757] Fix empty template variable {HISTORY_TITLE} The template variable {HISTORY_TITLE} was always being set to the empty string. It is now filled with the title of the currently displayed message. It is not showed in prosilver or subsilver2 for aesthetic reasons (title is already prominent) PHPBB3-9757 --- phpBB/includes/functions_privmsgs.php | 4 ++-- phpBB/styles/prosilver/template/ucp_pm_history.html | 2 +- phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 4fc5034f7b..c4cbb7ca1e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1751,6 +1751,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode return false; } + $title = $row['message_subject']; + $rowset = array(); $bbcode_bitfield = ''; $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; @@ -1774,8 +1776,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - $title = $row['message_subject']; - if (sizeof($rowset) == 1 && !$in_post_mode) { return false; diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index c555e90640..9051eb2ee0 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -1,7 +1,7 @@

{L_EXPAND_VIEW} - {L_MESSAGE_HISTORY}: {HISTORY_TITLE} + {L_MESSAGE_HISTORY}:

diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index 53391b30c9..8754acaaa2 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -6,7 +6,7 @@
{FOLDER_NEW_IMG}{L_NEW_POSTS}{FOLDER_UNREAD_IMG}{L_UNREAD_POSTS}    {FOLDER_IMG}{L_NO_NEW_POSTS}{L_NO_UNREAD_POSTS}    {FOLDER_ANNOUNCE_IMG} {L_ICON_ANNOUNCEMENT}
{FOLDER_HOT_NEW_IMG}{L_NEW_POSTS_HOT}{FOLDER_HOT_UNREAD_IMG}{L_UNREAD_POSTS_HOT}    {FOLDER_HOT_IMG}{L_NO_NEW_POSTS_HOT}{L_NO_UNREAD_POSTS_HOT}    {FOLDER_STICKY_IMG} {L_ICON_STICKY}
{FOLDER_LOCKED_NEW_IMG}{L_NEW_POSTS_LOCKED}{FOLDER_LOCKED_UNREAD_IMG}{L_UNREAD_POSTS_LOCKED}    {FOLDER_LOCKED_IMG}{L_NO_NEW_POSTS_LOCKED}{L_NO_UNREAD_POSTS_LOCKED}    {FOLDER_MOVED_IMG} {L_TOPIC_MOVED}'); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln(''); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln('
- +
{L_MESSAGE_HISTORY} - {HISTORY_TITLE}{L_MESSAGE_HISTORY}
From 47557fd4d2037915845f9fcfe863cea539eea7ac Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 8 Apr 2010 00:04:47 +0200 Subject: [PATCH 34/57] [ticket/9521] Fix error reporting for the native SQL Server plugin. The native SQL Server plugin used to return an error string when calling sql_error. However, some error condition checks are done using is_array. This patch wraps the error into an array to follow the error logic used elsewhere. PHPBB3-9521 --- phpBB/includes/db/mssqlnative.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 phpBB/includes/db/mssqlnative.php diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php old mode 100644 new mode 100755 index 08ee70907c..76595ca873 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -502,6 +502,7 @@ class dbal_mssqlnative extends dbal { $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); $error_message = ''; + $code = 0; if ($errors != null) { @@ -509,6 +510,7 @@ class dbal_mssqlnative extends dbal { $error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n"; $error_message .= "code: ".$error[ 'code']."\n"; + $code = $error['code']; $error_message .= "message: ".$error[ 'message']."\n"; } $this->last_error_result = $error_message; @@ -518,7 +520,11 @@ class dbal_mssqlnative extends dbal { $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); } - return $error; + + return array( + 'message' => $error, + 'code' => $code, + ); } /** From 8045f63b4122f79c549a436851059c670d13ce44 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Aug 2010 11:35:38 +0200 Subject: [PATCH 35/57] [ticket/9743] Fix background of top2-class in prosilver for RTL-languages. PHPBB3-9743 --- phpBB/styles/prosilver/theme/bidi.css | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 109312ac1b..f441784d85 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -236,6 +236,7 @@ } .rtl a.top2 { + background-position: 100% 50%; padding-left: 0; padding-right: 15px; } From 3e111bb41ad6a2ea954dd52bcf78b954114c37e9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 03:21:08 +0200 Subject: [PATCH 36/57] [ticket/9599] Adding network function tests. PHPBB3-9599 --- tests/all_tests.php | 2 ++ tests/network/all_tests.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/network/all_tests.php diff --git a/tests/all_tests.php b/tests/all_tests.php index 7894d688ee..8dc07872e8 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -24,6 +24,7 @@ require_once 'template/all_tests.php'; require_once 'text_processing/all_tests.php'; require_once 'dbal/all_tests.php'; require_once 'regex/all_tests.php'; +require_once 'network/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -46,6 +47,7 @@ class phpbb_all_tests $suite->addTest(phpbb_text_processing_all_tests::suite()); $suite->addTest(phpbb_dbal_all_tests::suite()); $suite->addTest(phpbb_regex_all_tests::suite()); + $suite->addTest(phpbb_network_all_tests::suite()); return $suite; } diff --git a/tests/network/all_tests.php b/tests/network/all_tests.php new file mode 100644 index 0000000000..07a7e57d48 --- /dev/null +++ b/tests/network/all_tests.php @@ -0,0 +1,36 @@ + Date: Fri, 14 May 2010 03:57:17 +0200 Subject: [PATCH 37/57] [ticket/9599] Adding tests for phpbb_checkdnsrr(). Tests for existing and non-existing records of the types: MX, A, AAAA, NS, CNAME, TXT PHPBB3-9599 --- tests/network/all_tests.php | 4 +++ tests/network/checkdnsrr.php | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/network/checkdnsrr.php diff --git a/tests/network/all_tests.php b/tests/network/all_tests.php index 07a7e57d48..b500647f81 100644 --- a/tests/network/all_tests.php +++ b/tests/network/all_tests.php @@ -15,6 +15,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; +require_once 'network/checkdnsrr.php'; + class phpbb_network_all_tests { public static function main() @@ -26,6 +28,8 @@ class phpbb_network_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions'); + $suite->addTestSuite('phpbb_network_checkdnsrr_test'); + return $suite; } } diff --git a/tests/network/checkdnsrr.php b/tests/network/checkdnsrr.php new file mode 100644 index 0000000000..57fe2761cc --- /dev/null +++ b/tests/network/checkdnsrr.php @@ -0,0 +1,63 @@ +assertEquals($expected, phpbb_checkdnsrr($host, $type)); + } +} From 24e23755cfe57afcf3125ba9c684b32942425696 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 19 May 2010 17:42:44 +0200 Subject: [PATCH 38/57] [ticket/9599] Reimplement phpbb_checkdnsrr() function. Use gethostbyname(), checkdnsrr(), dns_get_record() or nslookup via exec(). PHPBB3-9599 --- phpBB/includes/functions.php | 171 +++++++++++++++++++++++++++++++---- 1 file changed, 153 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc3d721de5..a61c28cb23 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3440,26 +3440,110 @@ function short_ipv6($ip, $length) /** * Wrapper for php's checkdnsrr function. * -* The windows failover is from the php manual -* Please make sure to check the return value for === true and === false, since NULL could -* be returned too. +* @param string $host Fully-Qualified Domain Name +* @param string $type Resource record type to lookup +* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME +* Other types may work or may not work * -* @return true if entry found, false if not, NULL if this function is not supported by this environment +* @return mixed true if entry found, +* false if entry not found, +* null if this function is not supported by this environment +* +* Since null can also be returned, you probably want to compare the result +* with === true or === false, +* +* @author bantu */ -function phpbb_checkdnsrr($host, $type = '') +function phpbb_checkdnsrr($host, $type = 'MX') { - $type = (!$type) ? 'MX' : $type; - - // Call checkdnsrr() if available. This is also the case on Windows with PHP 5.3 or later. - if (function_exists('checkdnsrr')) + // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) + if (substr($host, -1) == '.') { - // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) - return checkdnsrr($host . '.', $type); + $host_fqdn = $host; + $host = substr($host, 0, -1); } - else if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) + else { - // @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); - @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host) . '.', $output); + $host_fqdn = $host . '.'; + } + // $host has format some.host.example.com + // $host_fqdn has format some.host.example.com. + + // If we're looking for an A record we can use gethostbyname() + if ($type == 'A' && function_exists('gethostbyname')) + { + return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true; + } + + // checkdnsrr() is available on Windows since PHP 5.3, + // but until 5.3.3 it only works for MX records + // See: http://bugs.php.net/bug.php?id=51844 + + // Call checkdnsrr() if + // we're looking for an MX record or + // we're not on Windows or + // we're running a PHP version where #51844 has been fixed + + // checkdnsrr() supports AAAA since 5.0.0 + // checkdnsrr() supports TXT since 5.2.4 + if ( + ($type == 'MX' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.3', '>=')) && + ($type != 'AAAA' || version_compare(PHP_VERSION, '5.0.0', '>=')) && + ($type != 'TXT' || version_compare(PHP_VERSION, '5.2.4', '>=')) && + function_exists('checkdnsrr') + ) + { + return checkdnsrr($host_fqdn, $type); + } + + // dns_get_record() is available since PHP 5; since PHP 5.3 also on Windows, + // but on Windows it does not work reliable for AAAA records before PHP 5.3.1 + + // Call dns_get_record() if + // we're not looking for an AAAA record or + // we're not on Windows or + // we're running a PHP version where AAAA lookups work reliable + if ( + ($type != 'AAAA' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.1', '>=')) && + function_exists('dns_get_record') + ) + { + // dns_get_record() expects an integer as second parameter + // We have to convert the string $type to the corresponding integer constant. + $type_constant = 'DNS_' . $type; + $type_param = (defined($type_constant)) ? constant($type_constant) : DNS_ANY; + + // dns_get_record() might throw E_WARNING and return false for records that do not exist + $resultset = @dns_get_record($host_fqdn, $type_param); + + if (empty($resultset) || !is_array($resultset)) + { + return false; + } + else if ($type_param == DNS_ANY) + { + // $resultset is a non-empty array + return true; + } + + foreach ($resultset as $result) + { + if ( + isset($result['host']) && $result['host'] == $host && + isset($result['type']) && $result['type'] == $type + ) + { + return true; + } + } + + return false; + } + + // If we're on Windows we can still try to call nslookup via exec() as a last resort + if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) + { + @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host_fqdn), $output); // If output is empty, the nslookup failed if (empty($output)) @@ -3469,15 +3553,66 @@ function phpbb_checkdnsrr($host, $type = '') foreach ($output as $line) { - if (!trim($line)) + $line = trim($line); + + if (empty($line)) { continue; } - // Valid records begin with host name: - if (strpos($line, $host) === 0) + // Squash tabs and multiple whitespaces to a single whitespace. + $line = preg_replace('/\s+/', ' ', $line); + + switch ($type) { - return true; + case 'MX': + if (stripos($line, "$host MX") === 0) + { + return true; + } + break; + + case 'NS': + if (stripos($line, "$host nameserver") === 0) + { + return true; + } + break; + + case 'TXT': + if (stripos($line, "$host text") === 0) + { + return true; + } + break; + + case 'CNAME': + if (stripos($line, "$host canonical name") === 0) + { + return true; + } + + default: + case 'A': + case 'AAAA': + if (!empty($host_matches)) + { + // Second line + if (stripos($line, "Address: ") === 0) + { + return true; + } + else + { + $host_matches = false; + } + } + else if (stripos($line, "Name: $host") === 0) + { + // First line + $host_matches = true; + } + break; } } From 76348ce43f0dc657182746d185f9882d3349cd2c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 14:02:34 +0100 Subject: [PATCH 39/57] [ticket/9760] Remove unrestricted wildcards from search terms. Wildcards without any further result restrictions will cause phpBB to search for everything, potentially allowing a DoS attack against the DB server by any user who can use the search system. PHPBB3-9760 --- phpBB/includes/search/fulltext_native.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index c89e92711e..727e3aaffb 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -83,7 +83,9 @@ class fulltext_native extends search_backend { global $db, $user, $config; - $keywords = trim($this->cleanup($keywords, '+-|()*')); + $tokens = '+-|()*'; + + $keywords = trim($this->cleanup($keywords, $tokens)); // allow word|word|word without brackets if ((strpos($keywords, ' ') === false) && (strpos($keywords, '|') !== false) && (strpos($keywords, '(') === false)) @@ -114,6 +116,15 @@ class fulltext_native extends search_backend case ' ': $keywords[$i] = '|'; break; + case '*': + if ($i === 0 || ($keywords[$i - 1] !== '*' && strcspn($keywords[$i - 1], $tokens) === 0)) + { + if ($i === $n - 1 || ($keywords[$i + 1] !== '*' && strcspn($keywords[$i + 1], $tokens) === 0)) + { + $keywords = substr($keywords, 0, $i) . substr($keywords, $i + 1); + } + } + break; } } else From 013f0b62b8094ac537dc5aa025d82d9cb59250f1 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 16:14:05 +0100 Subject: [PATCH 40/57] [ticket/9771] Remove query string parameters that have no name. PHPBB3-9771 --- phpBB/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc3d721de5..4c461b5ee8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2519,6 +2519,11 @@ function build_url($strip_vars = false) $key = $arguments[0]; unset($arguments[0]); + if ($key === '') + { + continue; + } + $query[$key] = implode('=', $arguments); } From 42e7c8a44099f16c8695c3870ac3f8abcbb89a21 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 22:49:48 +0100 Subject: [PATCH 41/57] [ticket/7332] Collapse post details content down to a maximum of 300px heigh The MCP post details can be difficult to use if the post is particularly long this change shrinks the post area to a maximum of 300 pixels, like the topic review, making it easier to access the functions beneath the post content. PHPBB3-7332 --- phpBB/styles/prosilver/template/mcp_post.html | 4 +++- phpBB/styles/prosilver/theme/content.css | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 0265d7ce12..dab2d572a9 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -54,6 +54,8 @@ + {L_EXPAND_VIEW} +

{POST_SUBJECT}

@@ -84,7 +86,7 @@

-
+
{POST_PREVIEW}
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 417537e660..dfe00371e4 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -298,6 +298,15 @@ div[class].topic-actions { display: none; } +/* MCP Post details +----------------------------------------*/ +#post_details +{ + /* This will only work in IE7+, plus the others */ + overflow: auto; + max-height: 300px; +} + /* Content container styles ----------------------------------------*/ .content { From b7a1add009ec36ca1143fa75ebda828d0fdead80 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 22:54:21 +0100 Subject: [PATCH 42/57] [ticket/7332] Redirect users back to post details when performing actions. Moderators are redirected to the index page of the MCP after locking a post, a better location would be to direct them back to the post details. PHPBB3-7332 --- phpBB/includes/mcp/mcp_post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 1fbedbac4f..7098b4bbce 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -176,7 +176,7 @@ function mcp_post_details($id, $mode, $action) } $template->assign_vars(array( - 'U_MCP_ACTION' => "$url&i=main&quickmod=1", // Use this for mode paramaters + 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), From bfa7b287344462bbd6f8a0f02810f7a6b225f65a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Jul 2010 00:27:45 +0100 Subject: [PATCH 43/57] [task/git-tools] Append ticket identifier to commit message prior to editing. PHPBB3-9770 --- git-tools/hooks/commit-msg | 24 ------------------------ git-tools/hooks/prepare-commit-msg | 10 +++++++++- 2 files changed, 9 insertions(+), 25 deletions(-) delete mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg deleted file mode 100755 index db31d93698..0000000000 --- a/git-tools/hooks/commit-msg +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# A hook to append PHPBB3- to ticket/ -# branches. -# -# This is a commit-msg hook. -# -# To install this you can either copy or symlink it to -# $GIT_DIR/hooks, example: -# -# ln -s ../../git-tools/hooks/commit-msg \\ -# .git/hooks/commit-msg - -if grep '^\[ticket/' "$1" -then - # get branch name - branch="$(git symbolic-ref HEAD)" - - # strip off refs/heads/ticket - ticket_id="$(echo "$branch" | sed "s/refs\/heads\/ticket\///g")" - - echo >> "$1" - echo "PHPBB3-$ticket_id" >> "$1" -fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 033cb187c7..2bf25e58a4 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -30,5 +30,13 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")" # * also make sure the branch name begins with bug/ or feature/ if [ "$2" = "" ] then - echo "[$branch] $(cat "$1")" > "$1" + tail=""; + + # Branch is prefixed with 'ticket/', append ticket ID to message + if [ "$branch" != "${branch##ticket/}" ]; + then + tail="\n\nPHPBB3-${branch##ticket/}"; + fi + + echo "[$branch]$tail $(cat "$1")" > "$1" fi From 66e58234ecf05a4c9cbc401490c602694c920ed4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Jul 2010 01:03:43 +0100 Subject: [PATCH 44/57] [task/git-tools] Beginnings of a syntax checking hook. Currently this hook checks line length is less than or equal to 80 characters. PHPBB3-9768 --- git-tools/hooks/commit-msg | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg new file mode 100755 index 0000000000..be1923ab6b --- /dev/null +++ b/git-tools/hooks/commit-msg @@ -0,0 +1,26 @@ +#!/bin/sh +# +# A hook to check syntax of a phpBB3 commit message, per: +# * +# * +# +# This is a commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/commit-msg \\ +# .git/hooks/commit-msg + +status=0; + +if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ] +then + echo "The following lines are greater than 80 characters long:\n"; + + grep -nE '.{81,}' "$1"; + + status=1; +fi + +exit $status; From db13dc2d433ad635b8de3454292362d681a92fb4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 45/57] [task/git-tools] Vastly expanded commit-msg hook. This updated hook supports validates each line of the commit message confirms to the phpBB standards [1], there are two git config options which adjust the behaviour of the hook. They are: * phpbb.hooks.commit-msg.fatal: Set to false for the hook to allow commits with malformed structure, useful if you'll be squashing or editing the commits later. True is the default value. * phpbb.hooks.commit-msg.debug: Any integer value greater than 0 will increase the debugging verbosity of the hook, the default value is 0. [1] http://wiki.phpbb.com/display/DEV/Git PHPBB3-9768 --- git-tools/hooks/commit-msg | 229 ++++++++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 5 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index be1923ab6b..894e67aa09 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -12,15 +12,234 @@ # ln -s ../../git-tools/hooks/commit-msg \\ # .git/hooks/commit-msg -status=0; +config_ns="phpbb.hooks.commit-msg"; + +if [ "$(git config --bool $config_ns.fatal)" = "false" ] +then + fatal=0; +else + fatal=1; +fi + +debug_level=$(git config --int $config_ns.debug || echo 0); + +# Error codes +ERR_LENGTH=1; +ERR_HEADER=2; +ERR_EMPTY=3; +ERR_DESCRIPTION=4; +ERR_FOOTER=5; +ERR_EOF=6; +ERR_UNKNOWN=42; + +debug() +{ + local level; + + level=$1; + shift; + + if [ $debug_level -ge $level ] + then + echo $@; + fi +} + +quit() +{ + if [ $1 -gt 0 ] && [ $1 -ne $ERR_UNKNOWN ] && [ $fatal -eq 0 ] + then + exit 0; + else + exit $1; + fi +} if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ] then - echo "The following lines are greater than 80 characters long:\n"; + echo "The following lines are greater than 80 characters long:\n" >&2; - grep -nE '.{81,}' "$1"; + grep -nE '.{81,}' "$1" >&2; - status=1; + quit $ERR_LENGTH; fi -exit $status; +lines=$(wc --lines "$1" | cut -f1 -d" "); +expecting=header; +in_description=0; +in_empty=0; +ticket=0; +branch_regex="[a-z]+[a-z0-9-]*[a-z0-9]+"; +i=1; +tickets=""; + +while [ $i -le $lines ] +do + # Grab the line we are studying + line=$(head -n$i "$1" | tail -n1); + + debug 1 "==> [$i] $line (description: $in_description, empty: $in_empty)"; + + err=$ERR_UNKNOWN; + + if [ -z "$expecting" ] + then + quit $err; + fi + + debug 2 "Expecting: $expecting"; + + # Loop over each of the expected line formats + for expect in $expecting + do + # Reset the error code each iteration + err=$ERR_UNKNOWN; + + # Test for validity of each line format + # This is done first so $? contains the result + case $expect in + "header") + err=$ERR_HEADER; + echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$" + ;; + "empty") + err=$ERR_EMPTY; + echo "$line" | grep -Eq "^$" + ;; + "description") + err=$ERR_DESCRIPTION; + # Free flow text, the line length was constrained by the initial check + echo "$line" | grep -Eq "^.+$"; + ;; + "footer") + err=$ERR_FOOTER; + # Each ticket is on its own line + echo "$line" | grep -Eq "^PHPBB3-[0-9]+$"; + ;; + "eof") + err=$ERR_EOF; + # Should not end up here + false + ;; + *) + echo "Unrecognised token $expect" >&2; + quit $err; + ;; + esac + + # Preserve the result of the line check + result=$?; + + debug 2 "$expect - '$line' - $result"; + + if [ $result -eq 0 ] + then + # Break out the loop on success + # otherwise roll on round and keep looking for a match + break; + fi + done + + if [ $result -eq 0 ] + then + # Have we switched out of description mode? + if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] + then + # Yes, okay we need to backtrace one line and reanalyse + in_description=0; + i=$(( $i - $in_empty )); + + # Reset the empty counter + in_empty=0; + continue; + fi + + # Successful match, but on which line format + case $expect in + "header") + expecting="empty eof"; + + echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && ( + ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,'); + ) + ;; + "empty") + # Description might have empty lines as spacing + expecting="footer description"; + in_empty=$(($in_empty + 1)); + + if [ $in_description -eq 1 ] + then + expecting="$expecting empty"; + fi + ;; + "description") + expecting="description empty eof"; + in_description=1; + ;; + "footer") + expecting="footer eof"; + if [ "$tickets" = "" ] + then + tickets="$line"; + else + tickets="$tickets $line"; + fi + ;; + *) + echo "Unrecognised token $expect" >&2; + quit 254; + ;; + esac + + if [ "$expect" != "empty" ] + then + in_empty=0; + fi + + debug 3 "Now expecting: $expecting"; + else + # None of the expected line formats matched + # Guess we'll call it a day here then + echo "Syntax error on line $i:" >&2; + echo ">> $line" >&2; + echo -n "Expecting: " >&2; + echo "$expecting" | sed 's/ /, /g' >&2; + exit $err; + fi + + i=$(( $i + 1 )); +done + +# If EOF is expected exit cleanly +echo "$expecting" | grep -q "eof" || ( + # Unexpected EOF, error + echo "Unexpected EOF encountered" >&2; + quit $ERR_EOF; +) && ( + # Do post scan checks + if [ ! -z "$tickets" ] + then + # Check for duplicate tickets + dupes=$(echo "$tickets" | sed 's/ /\n/g' | sort | uniq -d); + + if [ ! -z "$dupes" ] + then + echo "The following tickets are repeated:" >&2; + echo "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2; + quit $ERR_FOOTER; + fi + fi + # Check the branch ticket is mentioned, doesn't make sense otherwise + if [ $ticket -gt 0 ] + then + echo "$tickets" | grep -Eq "\bPHPBB3-$ticket\b" || ( + echo "Ticket ID [$ticket] of branch missing from list of tickets:" >&2; + echo "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2; + quit $ERR_FOOTER; + ) || exit $?; + fi + # Got here okay exit to reality + exit 0; +); +exit $?; From a9046e5608ed362c7123cb006adab7102cd58e63 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 46/57] [task/git-tools] Adjust the hook to enforce that a ticket is always mentioned PHPBB3-9768 --- git-tools/hooks/commit-msg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 894e67aa09..b04a761c29 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -157,7 +157,7 @@ do # Successful match, but on which line format case $expect in "header") - expecting="empty eof"; + expecting="empty"; echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && ( ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,'); @@ -174,7 +174,7 @@ do fi ;; "description") - expecting="description empty eof"; + expecting="description empty"; in_description=1; ;; "footer") From e17ffa01e6f536b0868106405993361f1d978706 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 47/57] [task/git-tools] Ignore git commit message comments Git commit message comments can be contained anywhere in the message and this change ignores where they appear. PHPBB3-9768 --- git-tools/hooks/commit-msg | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index b04a761c29..d6ad57a38a 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -87,6 +87,12 @@ do quit $err; fi + if [ "${expecting#comment}" = "$expecting" ] + then + # Prefix comments to the expected tokens list + expecting="comment $expecting"; + fi + debug 2 "Expecting: $expecting"; # Loop over each of the expected line formats @@ -121,6 +127,9 @@ do # Should not end up here false ;; + "comment") + echo "$line" | grep -Eq "^#"; + ;; *) echo "Unrecognised token $expect" >&2; quit $err; @@ -143,7 +152,7 @@ do if [ $result -eq 0 ] then # Have we switched out of description mode? - if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] + if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ] then # Yes, okay we need to backtrace one line and reanalyse in_description=0; @@ -186,6 +195,9 @@ do tickets="$tickets $line"; fi ;; + "comment") + # Comments should expect the same thing again + ;; *) echo "Unrecognised token $expect" >&2; quit 254; From 91a60aa878e703ff9af714e0316828216d3dcfa3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 11:00:42 -0400 Subject: [PATCH 48/57] [ticket/7716] Data too long for column 'message_subject' PHPBB3-7716 --- phpBB/includes/functions_privmsgs.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index c4cbb7ca1e..ec05a2a555 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1316,6 +1316,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) // Recipient Information $recipients = $to = $bcc = array(); + // First of all make sure the subject are having the correct length. + // To achieve this without cutting off between special chars we convert to an array and then count the elements. + $subject = truncate_string($subject); + if ($mode != 'edit') { // Build Recipient List From 90d8fc7e869852bb5a6beadc63c52ea9cdb51adf Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 18 Aug 2010 22:52:26 -0400 Subject: [PATCH 49/57] [ticket/9777] Print error message in pre-commit hook when php is not installed. PHPBB3-9777 --- git-tools/hooks/pre-commit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 9719b91746..4d03359773 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -27,6 +27,13 @@ fi error=0 errors="" +if ! which $PHP_BIN >/dev/null 2>&1 +then + echo "PHP Syntax check failed:" + echo "PHP binary does not exist or is not in path: $PHP_BIN" + exit 1 +fi + # dash does not support $'\n': # http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html IFS=' From 44125f5533394e7d317b851111d6396c7567f3bd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 12:22:18 -0400 Subject: [PATCH 50/57] [ticket/9104] Safari does not display box headers correctly in the ACP. PHPBB3-9104 --- phpBB/adm/style/admin.css | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 5f1f01c0a9..4c3fa51af3 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -670,14 +670,10 @@ legend { position: relative; text-transform: none; line-height: 1.2em; - top: 0; + top: -.2em; vertical-align: middle; } -/* Hide from macIE \*/ -legend { top: -1.2em; } -/* end */ - * html legend { margin: 0 0 -10px -7px; line-height: 1em; From cc9a1952d968c3c83e8d331cb005468848c936e1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 23:48:25 -0400 Subject: [PATCH 51/57] [ticket/9635] Useless parameter $data['post_time'] in function submit_post. PHPBB3-9635 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f6f90575d4..5e25648eb8 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2537,7 +2537,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') { // Mark this topic as posted to - markread('post', $data['forum_id'], $data['topic_id'], $data['post_time']); + markread('post', $data['forum_id'], $data['topic_id']); } // Mark this topic as read From 932b35ab7a9f586e6a9b00416a8f4caf47e39630 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Aug 2010 13:41:06 -0400 Subject: [PATCH 52/57] [ticket/9782] Board disable radio set on when server load high PHPBB3-9782 --- phpBB/includes/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index e157053e61..79023cc7bc 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1831,7 +1831,7 @@ class user extends session // Is load exceeded? if ($config['limit_load'] && $this->load !== false) { - if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN')) + if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN')) { // Set board disabled to true to let the admins/mods get the proper notification $config['board_disable'] = '1'; From b73d45ffc8f35ae2112d5c4bb80dcdac0d5ce6ae Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 16 Aug 2010 22:49:14 +0100 Subject: [PATCH 53/57] [ticket/7972] Copying topics in the MCP now indexes the new topic. PHPBB3-7972 --- phpBB/includes/mcp/mcp_main.php | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 80c3559649..d5551f5114 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1048,6 +1048,35 @@ function mcp_fork_topic($topic_ids) $total_posts = 0; $new_topic_id_list = array(); + if ($topic_data['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = basename($config['search_type']); + + if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + if (!class_exists($search_type)) + { + include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + } + + $error = false; + $search = new $search_type($error); + $search_mode = 'post'; + + if ($error) + { + trigger_error($error); + } + } + else + { + $search_type = false; + } + foreach ($topic_data as $topic_id => $topic_row) { $sql_ary = array( @@ -1158,6 +1187,12 @@ function mcp_fork_topic($topic_ids) // Copy whether the topic is dotted markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); + if ($search_type) + { + $search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id); + $search_mode = 'reply'; // After one we index replies + } + // Copy Attachments if ($row['post_attachment']) { From d53312174169f311714da389b6a36fe6a4bc8f9a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Aug 2010 09:21:15 -0400 Subject: [PATCH 54/57] [ticket/9780] Add length check back to gen_rand_string(). PHPBB3-9780 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 980a26d525..36b9e18176 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -201,7 +201,7 @@ function set_config_count($config_name, $increment, $is_dynamic = false) function gen_rand_string($num_chars = 8) { // [a, z] + [0, 9] = 36 - return strtoupper(base_convert(unique_id(), 16, 36)); + return substr(strtoupper(base_convert(unique_id(), 16, 36)), 0, $num_chars); } /** From e09d6c6d7139375d8b645664bef295c82d585653 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 20 Aug 2010 21:12:18 +0200 Subject: [PATCH 55/57] [ticket/9780] Adding unit tests for gen_rand_string(). PHPBB3-9780 --- tests/all_tests.php | 2 + tests/random/all_tests.php | 40 ++++++++++++++++++++ tests/random/gen_rand_string.php | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 tests/random/all_tests.php create mode 100644 tests/random/gen_rand_string.php diff --git a/tests/all_tests.php b/tests/all_tests.php index 8dc07872e8..bae7725ee7 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -25,6 +25,7 @@ require_once 'text_processing/all_tests.php'; require_once 'dbal/all_tests.php'; require_once 'regex/all_tests.php'; require_once 'network/all_tests.php'; +require_once 'random/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -48,6 +49,7 @@ class phpbb_all_tests $suite->addTest(phpbb_dbal_all_tests::suite()); $suite->addTest(phpbb_regex_all_tests::suite()); $suite->addTest(phpbb_network_all_tests::suite()); + $suite->addTest(phpbb_random_all_tests::suite()); return $suite; } diff --git a/tests/random/all_tests.php b/tests/random/all_tests.php new file mode 100644 index 0000000000..c6ffe78024 --- /dev/null +++ b/tests/random/all_tests.php @@ -0,0 +1,40 @@ +addTestSuite('phpbb_random_gen_rand_string_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_random_all_tests::main') +{ + phpbb_random_all_tests::main(); +} diff --git a/tests/random/gen_rand_string.php b/tests/random/gen_rand_string.php new file mode 100644 index 0000000000..cd58d14ed3 --- /dev/null +++ b/tests/random/gen_rand_string.php @@ -0,0 +1,63 @@ +assertTrue($random_string_length >= self::MIN_STRING_LENGTH); + $this->assertTrue($random_string_length <= $num_chars); + $this->assertRegExp('#^[A-Z0-9]+$#', $random_string); + } + } + } + + public function test_gen_rand_string_friendly() + { + for ($tests = 0; $tests <= self::TEST_COUNT; ++$tests) + { + for ($num_chars = self::MIN_STRING_LENGTH; $num_chars <= self::MAX_STRING_LENGTH; ++$num_chars) + { + $random_string = gen_rand_string_friendly($num_chars); + $random_string_length = strlen($random_string); + + $this->assertTrue($random_string_length >= self::MIN_STRING_LENGTH); + $this->assertTrue($random_string_length <= $num_chars); + $this->assertRegExp('#^[A-NP-Z1-9]+$#', $random_string); + } + } + } +} From 2455a744e67dc2d0bbdf699af2d699b94aed3ad6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 11:00:42 -0400 Subject: [PATCH 56/57] [ticket/7716] Data too long for column 'message_subject' PHPBB3-7716 --- phpBB/includes/functions_privmsgs.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index c4cbb7ca1e..4c34bc92ca 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1380,6 +1380,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) } } + // First of all make sure the subject are having the correct length. + $subject = truncate_string($subject); + $db->sql_transaction('begin'); $sql = ''; From 32bffe1a3219b7360fbace7f8f8596b38dfcccf6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 21 Aug 2010 21:25:34 +0200 Subject: [PATCH 57/57] Revert "[ticket/7716] Data too long for column 'message_subject'" This reverts commit 91a60aa878e703ff9af714e0316828216d3dcfa3. --- phpBB/includes/functions_privmsgs.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ec05a2a555..c4cbb7ca1e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1316,10 +1316,6 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) // Recipient Information $recipients = $to = $bcc = array(); - // First of all make sure the subject are having the correct length. - // To achieve this without cutting off between special chars we convert to an array and then count the elements. - $subject = truncate_string($subject); - if ($mode != 'edit') { // Build Recipient List