aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-07-08 20:10:17 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-07-08 20:10:17 +0200
commita2918fd98e61db0e7e9885fb546abc024c84d0fc (patch)
tree9fa6b52d6bb55ec5256c67e821550e111ee50dbe
parent31b221ae913c49fa2e2a776bd9fd54659728fcd0 (diff)
parent6da582e8be50fa7211706625402215f6f87ed48b (diff)
downloadforums-a2918fd98e61db0e7e9885fb546abc024c84d0fc.tar
forums-a2918fd98e61db0e7e9885fb546abc024c84d0fc.tar.gz
forums-a2918fd98e61db0e7e9885fb546abc024c84d0fc.tar.bz2
forums-a2918fd98e61db0e7e9885fb546abc024c84d0fc.tar.xz
forums-a2918fd98e61db0e7e9885fb546abc024c84d0fc.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9704] Fix minor typo in coding guidelines. [ticket/9690] Add forthcoming Bing Bot to list of recognized bots [ticket/9451] Add optional $can_upload parameter to avatar_process_user(). [ticket/9593] A readme file for unit tests and running unit tests. [ticket/9570] Changed "system" to "guest" timezone in ACP, added explanation. [ticket/9589] Added sample nginx configuration file for phpbb.
-rw-r--r--phpBB/docs/coding-guidelines.html2
-rw-r--r--phpBB/docs/nginx.conf.sample70
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_users.php2
-rw-r--r--phpBB/includes/functions_user.php7
-rw-r--r--phpBB/includes/ucp/ucp_profile.php2
-rw-r--r--phpBB/install/database_update.php52
-rw-r--r--phpBB/install/install_install.php1
-rw-r--r--phpBB/language/en/acp/board.php3
-rw-r--r--tests/RUNNING_TESTS.txt33
10 files changed, 167 insertions, 7 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index f340b671cc..113910387c 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -297,7 +297,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
<div class="content">
- <p>Please note that these Guidelines applies to all php, html, javascript and css files.</p>
+ <p>Please note that these guidelines apply to all php, html, javascript and css files.</p>
<a name="namingvars"></a><h3>2.i. Variable/Function/Class Naming</h3>
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;
+ }
+}
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index c87dbcf601..7db361ba34 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/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 . '&amp;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 . '&amp;u=' . $user_row['user_id']));
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 93e4e6db07..bb99314ced 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'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 9d690cb2f1..83bbbf4577 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1697,6 +1697,58 @@ function change_database_data(&$no_updates, $version)
_add_modules($modules_to_install);
+ // 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/', ''),
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/<abbr title="Daylight Saving Time">DST</abbr>',
- '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.',
));
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