diff options
64 files changed, 595 insertions, 237 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 92bcf90039..dd8f4c279d 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -573,7 +573,11 @@ function validate_range($value_ary, &$error) 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff), - 'INT' => array('php_type' => 'int', 'min' => (int) 0x80000000, 'max' => (int) 0x7fffffff), + // Do not use (int) 0x80000000 - it evaluates to different + // values on 32-bit and 64-bit systems. + // Apparently -2147483648 is a float on 32-bit systems, + // despite fitting in an int, thus explicit cast is needed. + 'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff), 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html index 4df43eaaa0..9b5494b8b6 100644 --- a/phpBB/adm/style/install_footer.html +++ b/phpBB/adm/style/install_footer.html @@ -6,20 +6,9 @@ </div> </div> </div> - - <!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 - // --> - + <div id="page-footer"> - Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group </div> </div> diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html index 8af299ad57..03ca369562 100644 --- a/phpBB/adm/style/overall_footer.html +++ b/phpBB/adm/style/overall_footer.html @@ -6,21 +6,10 @@ </div> </div> </div> - - <!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 - // --> - + <div id="page-footer"> <!-- IF S_COPYRIGHT_HTML --> - Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html index 65cf724c2f..7276fb4b63 100644 --- a/phpBB/adm/style/simple_footer.html +++ b/phpBB/adm/style/simple_footer.html @@ -2,21 +2,10 @@ <br /><br /> </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -// --> - <div id="page-footer"> <!-- IF S_COPYRIGHT_HTML --> - <br />Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + <br />Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- ENDIF --> diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index 3782f53e4c..b5ed090a75 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -528,7 +528,7 @@ foreach ($lang_fp as $filepointer) $html_data .= ' <br><br> -<div class="copyright" align="center">Powered by phpBB 2.2 © <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group</div> <br clear="all" /></td> </tr> diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index b3166313c3..1dfb80141c 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -1,6 +1,6 @@ /** * -* phpBB3 © Copyright 2000, 2002, 2005, 2007 phpBB Group +* phpBB3 © Copyright phpBB Group * http://www.phpbb.com * * This program is free software: you can redistribute it and/or modify diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 66915b18fa..253df4ac56 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.0.x Changelog" /> <title>phpBB3 • Changelog</title> @@ -1676,7 +1676,7 @@ <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index f91d4bc223..83d7a342e0 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.0.x frequently asked questions" /> <title>phpBB3 • FAQ</title> @@ -328,7 +328,7 @@ I want to sue you because i think you host an illegal board!</h2> <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 5857163759..4af185beb3 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.0.x Installation, updating and conversion informations" /> <title>phpBB3 • Install</title> @@ -424,7 +424,7 @@ <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index bb88fdc01f..7a0a42b34f 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.0.x Readme" /> <title>phpBB3 • Readme</title> @@ -339,7 +339,7 @@ <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index 8973582bdb..88618fa640 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" /> <title>phpBB3 • Auth API</title> @@ -275,7 +275,7 @@ $auth_admin = new auth_admin(); <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 5a73554741..7434fa4870 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="Olympus coding guidelines document" /> <title>phpBB3 • Coding Guidelines</title> @@ -2369,7 +2369,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html index 34055c4661..a5fad0d530 100644 --- a/phpBB/docs/hook_system.html +++ b/phpBB/docs/hook_system.html @@ -8,7 +8,7 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2007 phpBB Group" /> +<meta name="copyright" content="phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="Hook System explanation" /> <title>phpBB3 • Hook System</title> @@ -867,7 +867,7 @@ function phpbb_hook_register(&$hook) <div class="content"> - <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> + <p>This application is opensource software released under the <a href="http://opensource.org/licenses/gpl-license.php">GPL</a>. Please see source code and the docs directory for more details. This package and its contents are Copyright (c) <a href="http://www.phpbb.com/">phpBB Group</a>, All Rights Reserved.</p> </div> diff --git a/phpBB/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf index a22a126ff4..2a11e057c5 100644 --- a/phpBB/docs/nginx.sample.conf +++ b/phpBB/docs/nginx.sample.conf @@ -45,6 +45,7 @@ http { # Deny access to internal phpbb files. location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { + internal; deny all; } @@ -59,6 +60,7 @@ http { # Deny access to version control system directories. location ~ /\.svn|/\.git { + internal; deny all; } } diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 5c1876d006..524a28561e 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -88,11 +88,11 @@ class acm if (!phpbb_is_writable($this->cache_dir)) { // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload()) - die($this->cache_dir . ' is NOT writable.'); + die('Fatal: ' . $this->cache_dir . ' is NOT writable.'); exit; } - die('Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx); + die('Fatal: Not able to open ' . $this->cache_dir . 'data_global.' . $phpEx); exit; } diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index c2cb2f9c11..598b390302 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -1055,14 +1055,14 @@ class acp_language $iso_src .= htmlspecialchars_decode($row['lang_author']); $compress->add_data($iso_src, 'language/' . $row['lang_iso'] . '/iso.txt'); - // index.html files - $compress->add_data('', 'language/' . $row['lang_iso'] . '/index.html'); - $compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.html'); - $compress->add_data('', 'language/' . $row['lang_iso'] . '/acp/index.html'); + // index.htm files + $compress->add_data('', 'language/' . $row['lang_iso'] . '/index.htm'); + $compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.htm'); + $compress->add_data('', 'language/' . $row['lang_iso'] . '/acp/index.htm'); if (sizeof($mod_files)) { - $compress->add_data('', 'language/' . $row['lang_iso'] . '/mods/index.html'); + $compress->add_data('', 'language/' . $row['lang_iso'] . '/mods/index.htm'); } $compress->close(); @@ -1217,7 +1217,7 @@ $lang = array_merge($lang, array( '; // Language files in language root directory - $this->main_files = array("common.$phpEx", "groups.$phpEx", "install.$phpEx", "mcp.$phpEx", "memberlist.$phpEx", "posting.$phpEx", "search.$phpEx", "ucp.$phpEx", "viewforum.$phpEx", "viewtopic.$phpEx", "help_bbcode.$phpEx", "help_faq.$phpEx"); + $this->main_files = array("captcha_qa.$phpEx", "captcha_recaptcha.$phpEx", "common.$phpEx", "groups.$phpEx", "install.$phpEx", "mcp.$phpEx", "memberlist.$phpEx", "posting.$phpEx", "search.$phpEx", "ucp.$phpEx", "viewforum.$phpEx", "viewtopic.$phpEx", "help_bbcode.$phpEx", "help_faq.$phpEx"); } /** diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php index f706c98d43..27422513d9 100644 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ b/phpBB/includes/captcha/captcha_gd_wave.php @@ -62,8 +62,8 @@ class captcha 'y' => mt_rand(10, 17) ), 'lower_left' => array( - 'x' => mt_rand($img_x - 5, $img_x - 45), - 'y' => mt_rand($img_y - 0, $img_y - 15) + 'x' => mt_rand($img_x - 45, $img_x - 5), + 'y' => mt_rand($img_y - 15, $img_y - 0), ), ); diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index eeddf1f41b..5d8d5fbd47 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -767,7 +767,7 @@ class dbal </div> </div> <div id="page-footer"> - Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group </div> </div> </body> diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 69be1627cf..398a02380b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1698,7 +1698,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s if ($config['load_db_lastread'] && $user->data['is_registered']) { // Get list of the unread topics - $last_mark = $user->data['user_lastmark']; + $last_mark = (int) $user->data['user_lastmark']; $sql_array = array( 'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time', @@ -1717,10 +1717,11 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s ), 'WHERE' => " + t.topic_last_post_time > $last_mark AND ( (tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR (tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR - (tt.mark_time IS NULL AND ft.mark_time IS NULL AND t.topic_last_post_time > $last_mark) + (tt.mark_time IS NULL AND ft.mark_time IS NULL) ) $sql_extra $sql_sort", @@ -2630,8 +2631,14 @@ function send_status_line($code, $message) } else { - if (isset($_SERVER['HTTP_VERSION'])) + if (!empty($_SERVER['SERVER_PROTOCOL'])) { + $version = $_SERVER['SERVER_PROTOCOL']; + } + else if (!empty($_SERVER['HTTP_VERSION'])) + { + // I cannot remember where I got this from. + // This code path may never be reachable in reality. $version = $_SERVER['HTTP_VERSION']; } else @@ -3432,30 +3439,26 @@ function get_preg_expression($mode) * Generate regexp for naughty words censoring * Depends on whether installed PHP version supports unicode properties * -* @param string $word word template to be replaced +* @param string $word word template to be replaced +* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode * * @return string $preg_expr regex to use with word censor */ -function get_censor_preg_expression($word) +function get_censor_preg_expression($word, $use_unicode = true) { - static $unicode = null; - - if (empty($word)) - { - return ''; - } + static $unicode_support = null; // Check whether PHP version supports unicode properties - if (is_null($unicode)) + if (is_null($unicode_support)) { - $unicode = ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) ? true : false; + $unicode_support = ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) ? true : false; } - if ($unicode) - { - // Unescape the asterisk to simplify further conversions - $word = str_replace('\*', '*', preg_quote($word, '#')); + // Unescape the asterisk to simplify further conversions + $word = str_replace('\*', '*', preg_quote($word, '#')); + if ($use_unicode && $unicode_support) + { // Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes $word = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*+(?=[\p{Nd}\p{L}_])#iu', '#^\*+#', '#\*+$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $word); @@ -3464,7 +3467,11 @@ function get_censor_preg_expression($word) } else { - $preg_expr = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($word, '#')) . ')(?!\S)#iu'; + // Replace the asterisk inside the pattern, at the start and at the end of it with regexes + $word = preg_replace(array('#(?<=\S)\*+(?=\S)#iu', '#^\*+#', '#\*+$#'), array('(\x20*?\S*?)', '\S*?', '\S*?'), $word); + + // Generate the final substitution + $preg_expr = '#(?<!\S)(' . $word . ')(?!\S)#iu'; } return $preg_expr; @@ -3834,7 +3841,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; - echo ' Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>'; + echo ' Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group'; echo ' </div>'; echo '</div>'; echo '</body>'; diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 5f5b39fe27..1dc854caf2 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1966,6 +1966,7 @@ class user extends session $key_found = $num; } + break; } } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 10308826e0..25b50c724e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -511,7 +511,7 @@ function _print_footer() </div> <div id="page-footer"> - Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group </div> </div> diff --git a/phpBB/install/index.php b/phpBB/install/index.php index eb51ca5fb2..49c99da0d7 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -652,7 +652,7 @@ class module echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; - echo ' Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>'; + echo ' Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group'; echo ' </div>'; echo '</div>'; echo '</body>'; diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index aeb6dc9ba3..1a044b0ca1 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -19,17 +19,6 @@ <span class="corners-bottom"><span></span></span></div> </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -//--> - <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 44857dbc41..009b514e52 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -8,7 +8,6 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" /> @@ -47,12 +46,9 @@ var onload_functions = new Array(); var onunload_functions = new Array(); - <!-- IF S_USER_PM_POPUP --> - if ({S_NEW_PM}) - { - var url = '{UA_POPUP_PM}'; - window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400'); - } + <!-- IF S_USER_PM_POPUP and S_NEW_PM --> + var url = '{UA_POPUP_PM}'; + window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400'); <!-- ENDIF --> /** diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html index e64e209368..daeb786fcb 100644 --- a/phpBB/styles/prosilver/template/simple_footer.html +++ b/phpBB/styles/prosilver/template/simple_footer.html @@ -1,16 +1,6 @@ </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - The phpBB Group : 2006 -//--> - - <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2000, 2002, 2005, 2007 phpBB Group + <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group <!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF --> <!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF --> </div> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 0e2409586c..66aae004a0 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -8,7 +8,6 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="" /> {META} diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 45ee6d1fae..c69bb82382 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -105,16 +105,6 @@ hr.sep { </table> <hr width="85%" /> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -//--> <table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> <tr> @@ -122,7 +112,7 @@ hr.sep { <td align="{S_CONTENT_FLOW_END}"><span class="gensmall">{S_TIMEZONE}</span></td> </tr> <tr> - <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group<br />http://www.phpbb.com/</span></td> + <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © phpBB Group<br />http://www.phpbb.com/</span></td> </tr> </table> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 03102dd351..541c48a53d 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -8,7 +8,6 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta name="robots" content="noindex" /> @@ -43,19 +42,9 @@ <!-- END postrow --> </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -//--> <div id="page-footer"> <div class="page-number">{S_TIMEZONE}<br />{PAGE_NUMBER}</div> - <div class="copyright">Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group<br />http://www.phpbb.com/</div> + <div class="copyright">Powered by phpBB © phpBB Group<br />http://www.phpbb.com/</div> </div> </div> diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 5d74ff9d8f..3f215def72 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -171,7 +171,7 @@ dl.details dd { border-color: #4692BF; } -.pagination span a, .pagination span a:link, .pagination span a:visited, .pagination span a:active { +.pagination span a, .pagination span a:link, .pagination span a:visited { color: #5C758C; background-color: #ECEDEE; border-color: #B4BAC0; @@ -183,6 +183,12 @@ dl.details dd { color: #FFF; } +.pagination span a:active { + color: #5C758C; + background-color: #ECEDEE; + border-color: #B4BAC0; +} + /* Pagination in viewforum for multipage topics */ .row .pagination { background-image: url("{T_THEME_PATH}/images/icon_pages.gif"); @@ -304,12 +310,12 @@ a.topictitle:active { color: #0D4473; } -.signature a, .signature a:visited, .signature a:active, .signature a:hover { +.signature a, .signature a:visited, .signature a:hover, .signature a:active { background-color: transparent; } /* Profile links */ -.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a { +.postprofile a:link, .postprofile a:visited, .postprofile dt.author a { color: #105289; } @@ -317,6 +323,10 @@ a.topictitle:active { color: #D31141; } +.postprofile a:active { + color: #105289; +} + /* Profile searchresults */ .search .postprofile a { color: #105289; diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index ea9ca8f4b1..a406114054 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -103,14 +103,14 @@ a.topictitle:active { color: #404040; } -.signature a, .signature a:visited, .signature a:active, .signature a:hover { +.signature a, .signature a:visited, .signature a:hover, .signature a:active { border: none; text-decoration: underline; background-color: transparent; } /* Profile links */ -.postprofile a:link, .postprofile a:active, .postprofile a:visited, .postprofile dt.author a { +.postprofile a:link, .postprofile a:visited, .postprofile dt.author a { font-weight: bold; color: #898989; text-decoration: none; @@ -121,6 +121,14 @@ a.topictitle:active { color: #d3d3d3; } +/* CSS spec requires a:link, a:visited, a:hover and a:active rules to be specified in this order. */ +/* See http://www.phpbb.com/bugs/phpbb3/59685 */ +.postprofile a:active { + font-weight: bold; + color: #898989; + text-decoration: none; +} + /* Profile searchresults */ .search .postprofile a { diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 68600b030b..2cfcd4da20 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -60,7 +60,7 @@ h3 { font-size: 14pt; margin-top: 1em; } } /* CSS2 Print tip from: http://www.alistapart.com/articles/goingtoprint/ */ -.postbody a:link, .postbody a:visited, .postbody a:active, .postbody a:hover { +.postbody a:link, .postbody a:visited, .postbody a:hover, .postbody a:active { text-decoration: underline; padding: 0.1em 0.2em; margin: -0.1em -0.2em; @@ -141,4 +141,4 @@ div.spacer { clear: both; } /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } -dl.codebox dt { display: none; }
\ No newline at end of file +dl.codebox dt { display: none; } diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html index 187d0f4366..b53fff9f7f 100644 --- a/phpBB/styles/subsilver2/template/overall_footer.html +++ b/phpBB/styles/subsilver2/template/overall_footer.html @@ -1,17 +1,6 @@ <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -//--> - <div id="wrapfooter"> <!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF --> <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 874beb8e2b..be4c7b5b4c 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -8,7 +8,6 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" /> @@ -29,11 +28,8 @@ <script type="text/javascript"> // <![CDATA[ -<!-- IF S_USER_PM_POPUP --> - if ({S_NEW_PM}) - { - popup('{UA_POPUP_PM}', 400, 225, '_phpbbprivmsg'); - } +<!-- IF S_USER_PM_POPUP and S_NEW_PM --> + popup('{UA_POPUP_PM}', 400, 225, '_phpbbprivmsg'); <!-- ENDIF --> function popup(url, width, height, name) diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html index c8b69dd5ad..1bd146b599 100644 --- a/phpBB/styles/subsilver2/template/simple_footer.html +++ b/phpBB/styles/subsilver2/template/simple_footer.html @@ -1,19 +1,8 @@ </div> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line, with - "phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our - forums may be affected. - - The phpBB Group : 2006 -//--> - <div id="wrapfooter"> - <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2000, 2002, 2005, 2007 phpBB Group</span> + <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group</span> </div> </body> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index bcef9a7059..b0dc908bc6 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -8,7 +8,6 @@ <meta http-equiv="imagetoolbar" content="no" /> <meta name="resource-type" content="document" /> <meta name="distribution" content="global" /> -<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" /> <meta name="keywords" content="" /> <meta name="description" content="" /> {META} diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html index f1c59df1c8..eff4a2a7dd 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html @@ -107,15 +107,6 @@ hr.sep { </table> <hr width="85%" /> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line. If you - refuse to include even this then support on our forums may be affected. - - The phpBB Group : 2006 -// --> <table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> <tr> @@ -123,7 +114,7 @@ hr.sep { <td align="{S_CONTENT_FLOW_END}"><span class="gensmall">{S_TIMEZONE}</span></td> </tr> <tr> - <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group<br />http://www.phpbb.com/</span></td> + <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © phpBB Group<br />http://www.phpbb.com/</span></td> </tr> </table> diff --git a/phpBB/styles/subsilver2/template/viewtopic_print.html b/phpBB/styles/subsilver2/template/viewtopic_print.html index cfd78b6fc7..38ec10fad8 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_print.html +++ b/phpBB/styles/subsilver2/template/viewtopic_print.html @@ -121,15 +121,6 @@ hr.sep { <!-- END postrow --> <hr width="85%" /> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain - the full copyright we ask you at least leave in place the "Powered by phpBB" line. If you - refuse to include even this then support on our forums may be affected. - - The phpBB Group : 2006 -// --> <table width="85%" cellspacing="3" cellpadding="0" border="0" align="center"> <tr> @@ -137,7 +128,7 @@ hr.sep { <td align="{S_CONTENT_FLOW_END}"><span class="gensmall">{S_TIMEZONE}</span></td> </tr> <tr> - <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group<br />http://www.phpbb.com/</span></td> + <td colspan="2" align="center"><span class="gensmall">Powered by phpBB © phpBB Group<br />http://www.phpbb.com/</span></td> </tr> </table> diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index 726efdca0a..c2b6718d87 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -210,13 +210,13 @@ p.topicdetails { margin: 1px 0; } -.postreported, .postreported a:visited, .postreported a:hover, .postreported a:link, .postreported a:active { +.postreported, .postreported a:link, .postreported a:visited, .postreported a:hover, .postreported a:active { margin: 1px 0; color: red; font-weight:bold; } -.postapprove, .postapprove a:visited, .postapprove a:hover, .postapprove a:link, .postapprove a:active { +.postapprove, .postapprove a:link, .postapprove a:visited, .postapprove a:hover, .postapprove a:active { color: green; font-weight:bold; } @@ -386,12 +386,13 @@ hr { unicode-bidi: embed; } +/* CSS spec requires a:link, a:visited, a:hover and a:active rules to be specified in this order. */ +/* See http://www.phpbb.com/bugs/phpbb3/59685 */ a:link { color: #006597; text-decoration: none; } -a:active, a:visited { color: #005784; text-decoration: none; @@ -402,6 +403,11 @@ a:hover { text-decoration: underline; } +a:active { + color: #005784; + text-decoration: none; +} + a.forumlink { color: #069; font-weight: bold; @@ -667,4 +673,4 @@ pre { .username-coloured { font-weight: bold; -}
\ No newline at end of file +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 99f145e427..1fba323277 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,7 +10,7 @@ define('IN_PHPBB', true); $phpbb_root_path = 'phpBB/'; $phpEx = 'php'; -$table_prefix = ''; +$table_prefix = 'phpbb_'; error_reporting(E_ALL & ~E_DEPRECATED); diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index 987de5cbff..533416f14b 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_dbal_select_test extends phpbb_database_test_case { diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index a24b6efcc4..4709d45fa5 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_dbal_write_test extends phpbb_database_test_case { diff --git a/tests/mock/cache.php b/tests/mock/cache.php new file mode 100644 index 0000000000..2ac46f7090 --- /dev/null +++ b/tests/mock/cache.php @@ -0,0 +1,61 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2008 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +class phpbb_mock_cache +{ + public function __construct($data = array()) + { + $this->data = $data; + + if (!isset($this->data['_bots'])) + { + $this->data['_bots'] = array(); + } + } + + public function get($var_name) + { + if (isset($this->data[$var_name])) + { + return $this->data[$var_name]; + } + + return false; + } + + public function put($var_name, $var, $ttl = 0) + { + $this->data[$var_name] = $var; + } + + /** + * Obtain active bots + */ + public function obtain_bots() + { + return $this->data['_bots']; + } + + public function set_bots($bots) + { + $this->data['_bots'] = $bots; + } + + public function checkVar(PHPUnit_Framework_Assert $test, $var_name, $data) + { + $test->assertTrue(isset($this->data[$var_name])); + $test->assertEquals($data, $this->data[$var_name]); + } + + public function check(PHPUnit_Framework_Assert $test, $data) + { + $test->assertEquals($data, $this->data); + } +} + diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php new file mode 100644 index 0000000000..2d7d42f82a --- /dev/null +++ b/tests/mock/session_testable.php @@ -0,0 +1,56 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2008 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once '../phpBB/includes/functions.php'; +require_once '../phpBB/includes/session.php'; + +class phpbb_mock_session_testable extends session +{ + private $_cookies = array(); + + public function set_cookie($name, $data, $time) + { + $this->_cookies[$name] = array($data, $time); + } + + /** + * Checks if the cookies were set correctly. + * + * @param PHPUnit_Framework_Assert test The test from which this is called + * @param array(string => mixed) cookies The cookie data to check against. + * The keys are cookie names, the values can either be null to + * check only the existance of the cookie, or an array(d, t), + * where d is the cookie data to check, or null to skip the + * check and t is the cookie time to check, or null to skip. + */ + public function check_cookies(PHPUnit_Framework_Assert $test, $cookies) + { + $test->assertEquals(array_keys($cookies), array_keys($this->_cookies), 'Incorrect cookies were set'); + + foreach ($cookies as $name => $cookie) + { + if (!is_null($cookie)) + { + $data = $cookie[0]; + $time = $cookie[1]; + + if (!is_null($data)) + { + $test->assertEquals($data, $this->_cookies[$name][0], "Cookie $name contains incorrect data"); + } + + if (!is_null($time)) + { + $test->assertEquals($time, $this->_cookies[$name][1], "Cookie $name expires at the wrong time"); + } + } + } + } +} + diff --git a/tests/network/checkdnsrr_test.php b/tests/network/checkdnsrr_test.php index 9410deaf64..5a756dcef8 100644 --- a/tests/network/checkdnsrr_test.php +++ b/tests/network/checkdnsrr_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; /** * @group slow diff --git a/tests/random/gen_rand_string_test.php b/tests/random/gen_rand_string_test.php index fa519f134c..115c55e4e2 100644 --- a/tests/random/gen_rand_string_test.php +++ b/tests/random/gen_rand_string_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_random_gen_rand_string_test extends phpbb_test_case { diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php index ae2d86e07e..fa9104e71d 100644 --- a/tests/regex/censor_test.php +++ b/tests/regex/censor_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_regex_censor_test extends phpbb_test_case { @@ -31,9 +31,19 @@ class phpbb_regex_censor_test extends phpbb_test_case /** * @dataProvider censor_test_data */ - public function test_censor($pattern, $subject) + public function test_censor_unicode($pattern, $subject) { - $regex = get_censor_preg_expression($pattern); + $regex = get_censor_preg_expression($pattern, true); + + $this->assertRegExp($regex, $subject); + } + + /** + * @dataProvider censor_test_data + */ + public function test_censor_no_unicode($pattern, $subject) + { + $regex = get_censor_preg_expression($pattern, false); $this->assertRegExp($regex, $subject); } diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php index 5d6e207cbb..0695b801d5 100644 --- a/tests/regex/email_test.php +++ b/tests/regex/email_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_regex_email_test extends phpbb_test_case { diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php index 735a2c4384..9829547508 100644 --- a/tests/regex/ipv4_test.php +++ b/tests/regex/ipv4_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_regex_ipv4_test extends phpbb_test_case { diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php index 187588f861..1b2018403c 100644 --- a/tests/regex/ipv6_test.php +++ b/tests/regex/ipv6_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_regex_ipv6_test extends phpbb_test_case { diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php index 246cbf549c..c3a336063a 100644 --- a/tests/regex/url_test.php +++ b/tests/regex/url_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_regex_url_test extends phpbb_test_case { diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php index 0901b43920..fa17b1909f 100644 --- a/tests/request/request_var_test.php +++ b/tests/request/request_var_test.php @@ -7,8 +7,8 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_request_request_var_test extends phpbb_test_case { diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index ff0ab4d1bb..71c7a3a397 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -7,10 +7,10 @@ * */ -require_once __DIR__ . '/base.php'; +require_once dirname(__FILE__) . '/base.php'; -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/session.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; class phpbb_security_extract_current_page_test extends phpbb_security_test_base { diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index c53414e7df..70ba8527b1 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -7,10 +7,10 @@ * */ -require_once __DIR__ . '/base.php'; +require_once dirname(__FILE__) . '/base.php'; -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/session.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; class phpbb_security_redirect_test extends phpbb_security_test_base { diff --git a/tests/session/fixtures/sessions_empty.xml b/tests/session/fixtures/sessions_empty.xml new file mode 100644 index 0000000000..66fa585b18 --- /dev/null +++ b/tests/session/fixtures/sessions_empty.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <row> + <value>1</value> + <value>anonymous</value> + </row> + <row> + <value>3</value> + <value>foo</value> + </row> + <row> + <value>4</value> + <value>bar</value> + </row> + </table> +</dataset> diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml new file mode 100644 index 0000000000..4559a08c55 --- /dev/null +++ b/tests/session/fixtures/sessions_full.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username_clean</column> + <row> + <value>1</value> + <value>anonymous</value> + </row> + <row> + <value>3</value> + <value>foo</value> + </row> + <row> + <value>4</value> + <value>bar</value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_ip</column> + <column>session_browser</column> + <row> + <value>anon_session</value> + <value>1</value> + <value>127.0.0.1</value> + <value>anonymous user agent</value> + </row> + <row> + <value>bar_session</value> + <value>4</value> + <value>127.0.0.1</value> + <value>user agent</value> + </row> + </table> +</dataset> diff --git a/tests/session/session_continue.php b/tests/session/session_continue.php new file mode 100644 index 0000000000..58956c18a9 --- /dev/null +++ b/tests/session/session_continue.php @@ -0,0 +1,117 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2008 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once 'test_framework/framework.php'; +require_once 'mock/cache.php'; +require_once 'mock/session_testable.php'; + +class phpbb_session_continue_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_full.xml'); + } + + static public function session_begin_attempts() + { + return array( + array( + 'bar_session', '4', 'user agent', + array( + array('session_id' => 'anon_session', 'session_user_id' => 1), + array('session_id' => 'bar_session', 'session_user_id' => 4) + ), + array(), + 'Check if no new session was created', + ), + array( + 'anon_session', '4', 'user agent', + array( + array('session_id' => 'bar_session', 'session_user_id' => 4), + array('session_id' => null, 'session_user_id' => 1) // use generated SID + ), + array( + 'u' => array('1', null), + 'k' => array(null, null), + 'sid' => array($_SID, null), + ), + 'Check if an anonymous new session was created', + ), + ); + } + + /** + * @dataProvider session_begin_attempts + */ + public function test_session_begin_valid_session($session_id, $user_id, $user_agent, $expected_sessions, $expected_cookies, $message) + { + $session = new phpbb_mock_session_testable; + $session->page = array('page' => 'page', 'forum' => 0); + + // set up all the global variables used in session_create + global $SID, $_SID, $db, $config, $cache; + + $config = $this->get_config(); + $db = $this->new_dbal(); + $cache_data = array( + '_bots' => array(), + ); + $cache = new phpbb_mock_cache; + $SID = $_SID = null; + + $_COOKIE['_sid'] = $session_id; + $_COOKIE['_u'] = $user_id; + $_SERVER['HTTP_USER_AGENT'] = $user_agent; + + $config['session_length'] = time(); // need to do this to allow sessions started at time 0 + $session->session_begin(); + + $sql = 'SELECT session_id, session_user_id + FROM phpbb_sessions'; + + // little tickery to allow using a dataProvider with dynamic expected result + foreach ($expected_sessions as $i => $s) + { + if (is_null($s['session_id'])) + { + $expected_sessions[$i]['session_id'] = $session->session_id; + } + } + + $this->assertResultEquals( + $sql, + $expected_sessions, + 'Check if no new session was created' + ); + + $session->check_cookies($this, $expected_cookies); + + $cache->check($this, $cache_data); + } + static public function get_config() + { + return array( + 'allow_autologin' => false, + 'auth_method' => 'db', + 'forwarded_for_check' => true, + 'active_sessions' => 0, // disable + 'rand_seed' => 'foo', + 'rand_seed_last_update' => 0, + 'max_autologin_time' => 0, + 'session_length' => 100, + 'form_token_lifetime' => 100, + 'cookie_name' => '', + 'limit_load' => 0, + 'limit_search_load' => 0, + 'ip_check' => 3, + 'browser_check' => 1, + ); + } +} + diff --git a/tests/session/session_init.php b/tests/session/session_init.php new file mode 100644 index 0000000000..f6fa564880 --- /dev/null +++ b/tests/session/session_init.php @@ -0,0 +1,76 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2008 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once 'test_framework/framework.php'; +require_once 'mock/cache.php'; +require_once 'mock/session_testable.php'; + +class phpbb_session_init_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/sessions_empty.xml'); + } + + // also see security/extract_current_page.php + + public function test_login_session_create() + { + $session = new phpbb_mock_session_testable; + $session->page = array('page' => 'page', 'forum' => 0); + + // set up all the global variables used in session_create + global $SID, $_SID, $db, $config, $cache; + + $config = $this->get_config(); + $db = $this->new_dbal(); + $cache_data = array( + '_bots' => array(), + ); + $cache = new phpbb_mock_cache; + $SID = $_SID = null; + + $session->session_create(3); + + $sql = 'SELECT session_user_id + FROM phpbb_sessions'; + + $this->assertResultEquals( + $sql, + array(array('session_user_id' => 3)), + 'Check if exacly one session for user id 3 was created' + ); + + $cookie_expire = $session->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000); + + $session->check_cookies($this, array( + 'u' => array(null, $cookie_expire), + 'k' => array(null, $cookie_expire), + 'sid' => array($_SID, $cookie_expire), + )); + + $cache->check($this, $cache_data); + } + + static public function get_config() + { + return array( + 'allow_autologin' => false, + 'auth_method' => 'db', + 'forwarded_for_check' => true, + 'active_sessions' => 0, // disable + 'rand_seed' => 'foo', + 'rand_seed_last_update' => 0, + 'max_autologin_time' => 0, + 'session_length' => 100, + 'form_token_lifetime' => 100, + ); + } +} + diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 35df17e4c6..1b2f35f210 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -7,8 +7,8 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/template.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/template.php'; class phpbb_template_template_test extends phpbb_test_case { diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 9752ec2fe6..32d2696f1c 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -111,9 +111,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '', ); } - else if (file_exists(__DIR__ . '/../test_config.php')) + else if (file_exists(dirname(__FILE__) . '/../test_config.php')) { - include(__DIR__ . '/../test_config.php'); + include(dirname(__FILE__) . '/../test_config.php'); return array( 'dbms' => $dbms, @@ -129,7 +129,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test // Silently use sqlite return array( 'dbms' => 'sqlite', - 'dbhost' => __DIR__ . '/../phpbb_unit_tests.sqlite2', // filename + 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename 'dbport' => '', 'dbname' => '', 'dbuser' => '', @@ -340,7 +340,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } - $sql = $this->split_sql_file(file_get_contents(__DIR__ . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']); + $sql = $this->split_sql_file(file_get_contents(dirname(__FILE__) . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']); foreach ($sql as $query) { @@ -376,7 +376,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $config = $this->get_database_config(); - require_once __DIR__ . '/../../phpBB/includes/db/' . $config['dbms'] . '.php'; + require_once dirname(__FILE__) . '/../../phpBB/includes/db/' . $config['dbms'] . '.php'; $dbal = 'dbal_' . $config['dbms']; $db = new $dbal(); $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); @@ -384,6 +384,17 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test return $db; } + public function assertSqlResultEquals($expected, $sql, $message = '') + { + $db = $this->new_dbal(); + + $result = $db->sql_query($sql); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $this->assertEquals($expected, $rows, $message); + } + public function setExpectedTriggerError($errno, $message = '') { $this->get_test_case_helpers()->setExpectedTriggerError($errno, $message); diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php index 75a35daf82..29b982d709 100644 --- a/tests/text_processing/make_clickable_test.php +++ b/tests/text_processing/make_clickable_test.php @@ -7,8 +7,8 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/functions.php'; -require_once __DIR__ . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; class phpbb_text_processing_make_clickable_test extends phpbb_test_case { diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php new file mode 100644 index 0000000000..6c60583a7b --- /dev/null +++ b/tests/user/lang_test.php @@ -0,0 +1,58 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; + +class phpbb_user_lang_test extends phpbb_test_case +{ + public function test_user_lang_sprintf() + { + $user = new user; + $user->lang = array( + 'FOO' => 'BAR', + 'BARZ' => 'PENG', + 'EMPTY' => '', + 'ZERO' => '0', + 'STR' => '%d %s, %d topics', + 'STR2' => '%d foos', + 'ARRY' => array( + 0 => 'No posts', // 0 + 1 => '1 post', // 1 + 2 => '%d posts', // 2+ + ), + ); + + // No param + $this->assertEquals($user->lang('FOO'), 'BAR'); + $this->assertEquals($user->lang('EMPTY'), ''); + $this->assertEquals($user->lang('ZERO'), '0'); + + // Invalid index + $this->assertEquals($user->lang('VOID'), 'VOID'); + + // Unnecessary param + $this->assertEquals($user->lang('FOO', 2), 'BAR'); + $this->assertEquals($user->lang('FOO', 2, 3), 'BAR'); + $this->assertEquals($user->lang('FOO', 2, 3, 'BARZ'), 'BAR'); + + // String + $this->assertEquals($user->lang('STR', 24, 'x', 42), '24 x, 42 topics'); + $this->assertEquals($user->lang('STR2', 64), '64 foos'); + + // Array + $this->assertEquals($user->lang('ARRY', 0), 'No posts'); + $this->assertEquals($user->lang('ARRY', 1), '1 post'); + $this->assertEquals($user->lang('ARRY', 2), '2 posts'); + $this->assertEquals($user->lang('ARRY', 123), '123 posts'); + + // Bug PHPBB3-9949 + $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); + $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); + } +} diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php index 9a9011c0fe..38b4ec1b6b 100644 --- a/tests/utf/normalizer_test.php +++ b/tests/utf/normalizer_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/utf/utf_normalizer.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_normalizer.php'; /** * @group slow @@ -16,8 +16,8 @@ class phpbb_utf_normalizer_test extends phpbb_test_case { static public function setUpBeforeClass() { - self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', __DIR__.'/data'); - self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', __DIR__.'/data'); + self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', dirname(__FILE__).'/data'); + self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', dirname(__FILE__).'/data'); } public function test_normalizer() @@ -62,7 +62,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case $tested_chars = array(); - $fp = fopen(__DIR__.'/data/NormalizationTest.txt', 'rb'); + $fp = fopen(dirname(__FILE__).'/data/NormalizationTest.txt', 'rb'); while (!feof($fp)) { $line = fgets($fp); @@ -117,7 +117,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case */ public function test_invariants(array $tested_chars) { - $fp = fopen(__DIR__.'/data/UnicodeData.txt', 'rb'); + $fp = fopen(dirname(__FILE__).'/data/UnicodeData.txt', 'rb'); while (!feof($fp)) { diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php index 148297ad4b..e5a771eafa 100644 --- a/tests/utf/utf8_clean_string_test.php +++ b/tests/utf/utf8_clean_string_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_utf_utf8_clean_string_test extends phpbb_test_case { diff --git a/tests/utf/utf8_wordwrap_test.php b/tests/utf/utf8_wordwrap_test.php index fbc947b92a..03fa9dc38c 100644 --- a/tests/utf/utf8_wordwrap_test.php +++ b/tests/utf/utf8_wordwrap_test.php @@ -7,7 +7,7 @@ * */ -require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; class phpbb_utf_utf8_wordwrap_test extends phpbb_test_case { |