From bb32daab6352fc24c944aa3258ae1f59f6025a93 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 4 May 2010 10:39:22 -0400 Subject: [PATCH 1/6] [ticket/9589] Added sample nginx configuration file for phpbb. PHPBB3-9589 --- phpBB/docs/nginx.conf.sample | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 phpBB/docs/nginx.conf.sample diff --git a/phpBB/docs/nginx.conf.sample b/phpBB/docs/nginx.conf.sample new file mode 100644 index 0000000000..a22a126ff4 --- /dev/null +++ b/phpBB/docs/nginx.conf.sample @@ -0,0 +1,70 @@ +# Sample nginx configuration file for phpBB. +# Global settings have been removed, copy them +# from your system's nginx.conf. +# Tested with nginx 0.8.35. + +http { + # Compression - requires gzip and gzip static modules. + gzip on; + gzip_static on; + gzip_vary on; + gzip_http_version 1.1; + gzip_min_length 700; + gzip_comp_level 6; + gzip_disable "MSIE [1-6]\."; + + # Catch-all server for requests to invalid hosts. + # Also catches vulnerability scanners probing IP addresses. + # Should be first. + server { + listen 80; + server_name bogus; + return 444; + root /var/empty; + } + + # If you have domains with and without www prefix, + # redirect one to the other. + server { + listen 80; + server_name myforums.com; + rewrite ^(.*)$ http://www.myforums.com$1 permanent; + } + + # The actual board domain. + server { + listen 80; + server_name www.myforums.com; + + root /path/to/phpbb; + + location / { + # phpbb uses index.htm + index index.php index.html index.htm; + } + + # Deny access to internal phpbb files. + location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { + deny all; + } + + # Pass the php scripts to fastcgi server specified in upstream declaration. + location ~ \.php$ { + fastcgi_pass php; + # Necessary for php. + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + # Unmodified fastcgi_params from nginx distribution. + include fastcgi_params; + } + + # Deny access to version control system directories. + location ~ /\.svn|/\.git { + deny all; + } + } + + # If running php as fastcgi, specify php upstream. + upstream php { + server unix:/tmp/php.sock; + } +} From 097854ca8594676439dd8aab740674c717dda4cd Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 25 Apr 2010 10:37:34 -0400 Subject: [PATCH 2/6] [ticket/9570] Changed "system" to "guest" timezone in ACP, added explanation. PHPBB3-9570 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/language/en/acp/board.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7680d8996c..927e72010e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -58,7 +58,7 @@ class acp_board 'board_disable_msg' => false, 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), - 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => false), + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 52389d85b9..80db81653d 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -50,7 +50,8 @@ $lang = array_merge($lang, array( 'SITE_DESC' => 'Site description', 'SITE_NAME' => 'Site name', 'SYSTEM_DST' => 'Enable Summer Time/DST', - 'SYSTEM_TIMEZONE' => 'System timezone', + 'SYSTEM_TIMEZONE' => 'Guest timezone', + 'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in user control panel.', 'WARNINGS_EXPIRE' => 'Warning duration', 'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before the warning will automatically expire from a user’s record.', )); From 030f9c03c66950d4ec94567108f4baa8da709ab6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 8 May 2010 16:41:18 -0400 Subject: [PATCH 3/6] [ticket/9593] A readme file for unit tests and running unit tests. Added a readme file explaining prerequisites for unit tests, and how to run unit tests. PHPBB3-9593 --- tests/RUNNING_TESTS.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/RUNNING_TESTS.txt diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt new file mode 100644 index 0000000000..f1b40f71ad --- /dev/null +++ b/tests/RUNNING_TESTS.txt @@ -0,0 +1,33 @@ +Running Tests +------------- + +Prerequisites +------------- + +PHPUnit +======= + +phpBB unit tests use PHPUnit framework. Version 3.3 or better is required +to run the tests. PHPUnit prefers to be installed via PEAR; refer to +http://www.phpunit.de/ for more information. + +PHP extensions +============== + +Unit tests use several PHP extensions that board code does not use. Currently +the following PHP extensions must be installed and enabled to run unit tests: + +- ctype + +Running +------- + +Once the prerequisites are installed, run the tests from tests directory: + +$ phpunit all_tests.php + +More Information +---------------- + +Further information is available on phpbb wiki: +http://wiki.phpbb.com/display/DEV/Unit+Tests From e130a6bad94f534b3e573efcdb2b94332426598e Mon Sep 17 00:00:00 2001 From: Thatbitextra Date: Wed, 28 Apr 2010 16:57:16 -0400 Subject: [PATCH 4/6] [ticket/9451] Add optional $can_upload parameter to avatar_process_user(). Avoid unnecessary overhead in avatar_process_user() by optionally passing in the value of $can_upload. PHPBB3-9451 --- phpBB/includes/acp/acp_users.php | 2 +- phpBB/includes/functions_user.php | 7 +++++-- phpBB/includes/ucp/ucp_profile.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7914edd056..3a405da825 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1706,7 +1706,7 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - if (avatar_process_user($error, $user_row)) + if (avatar_process_user($error, $user_row, $can_upload)) { trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..d2c3df7c4d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2284,7 +2284,7 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ /** * Uploading/Changing user avatar */ -function avatar_process_user(&$error, $custom_userdata = false) +function avatar_process_user(&$error, $custom_userdata = false, $can_upload = null) { global $config, $phpbb_root_path, $auth, $user, $db; @@ -2323,7 +2323,10 @@ function avatar_process_user(&$error, $custom_userdata = false) $avatar_select = basename(request_var('avatar_select', '')); // Can we upload? - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + if (is_null($can_upload)) + { + $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + } if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) { diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f4f4abad4a..363a4803b6 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -572,7 +572,7 @@ class ucp_profile { if (check_form_key('ucp_avatar')) { - if (avatar_process_user($error)) + if (avatar_process_user($error, false, $can_upload)) { meta_refresh(3, $this->u_action); $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); From d00f2ec1832f6c391a1526a1263d45ed98d17e23 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sat, 3 Jul 2010 22:12:25 -0500 Subject: [PATCH 5/6] [ticket/9690] Add forthcoming Bing Bot to list of recognized bots Microsoft will rename MSN Bot to Bing Bot later this year, and change its user agent. This updates phpBB to be aware of Bing Bot PHPBB3-9690 --- phpBB/install/database_update.php | 52 +++++++++++++++++++++++++++++++ phpBB/install/install_install.php | 1 + 2 files changed, 53 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..708abcb64d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1685,6 +1685,58 @@ function change_database_data(&$no_updates, $version) $db->sql_freeresult($result); + // add Bing Bot + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $bot_name = 'Bing [Bot]'; + $bot_agent = 'bingbot/'; + $bot_ip = ''; + + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_row['group_id'], + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => $group_row['group_colour'], + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => $config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )); + + _sql($sql, $errored, $error_ary); + // end Bing Bot addition + $no_updates = false; break; } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f4989b5bd7..4c22db07b2 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -2108,6 +2108,7 @@ class install_install extends module 'Alta Vista [Bot]' => array('Scooter/', ''), 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), 'Baidu [Spider]' => array('Baiduspider+(', ''), + 'Bing [Bot]' => array('bingbot/', ''), 'Exabot [Bot]' => array('Exabot/', ''), 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), From 58cb46d344685c7bba4579e5b693ec448877d7cd Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 8 Jul 2010 09:15:03 +0200 Subject: [PATCH 6/6] [ticket/9704] Fix minor typo in coding guidelines. PHPBB3-9704 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 7f747e09e2..1978a0a307 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -288,7 +288,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
-

Please note that these Guidelines applies to all php, html, javascript and css files.

+

Please note that these guidelines apply to all php, html, javascript and css files.

2.i. Variable/Function Naming