mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
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.
This commit is contained in:
commit
a2918fd98e
@ -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>
|
||||
|
||||
|
70
phpBB/docs/nginx.conf.sample
Normal file
70
phpBB/docs/nginx.conf.sample
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -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),
|
||||
|
@ -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']));
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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>');
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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/', ''),
|
||||
|
@ -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.',
|
||||
));
|
||||
|
33
tests/RUNNING_TESTS.txt
Normal file
33
tests/RUNNING_TESTS.txt
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user