From 4091f873eaa108cebd3192ede979ce61ead09238 Mon Sep 17 00:00:00 2001
From: rxu
Date: Mon, 18 Oct 2010 21:25:52 +0800
Subject: [ticket/6712] Bump does not create new topic icon on index.
Handle the topic bumping process more properly.
PHPBB3-6712
---
phpBB/includes/functions_posting.php | 91 ++++++++++++++++++++++++++++++++++++
phpBB/posting.php | 30 +-----------
2 files changed, 92 insertions(+), 29 deletions(-)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6fd87db663..041b549cd6 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2611,4 +2611,95 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
return $url;
}
+/*
+* Handle topic bumping
+*/
+function bump_topic($forum_id, $topic_id, &$post_data, $current_time = false)
+{
+ global $config, $db, $user, $phpEx, $phpbb_root_path;
+
+ if ($current_time === false)
+ {
+ $current_time = time();
+ }
+
+ // Begin bumping
+ $db->sql_transaction('begin');
+
+ // Update the topic's last post post_time
+ $sql = 'UPDATE ' . POSTS_TABLE . "
+ SET post_time = $current_time
+ WHERE post_id = {$post_data['topic_last_post_id']}
+ AND topic_id = $topic_id";
+ $db->sql_query($sql);
+
+ // Sync the topic's last post time, the rest of the topic's last post data isn't changed
+ $sql = 'UPDATE ' . TOPICS_TABLE . "
+ SET topic_last_post_time = $current_time,
+ topic_bumped = 1,
+ topic_bumper = " . $user->data['user_id'] . "
+ WHERE topic_id = $topic_id";
+ $db->sql_query($sql);
+
+ // Update the forum's last post info
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ",
+ forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ",
+ forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "',
+ forum_last_post_time = $current_time,
+ forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "',
+ forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "'
+ WHERE forum_id = $forum_id";
+ $db->sql_query($sql);
+
+ // Update bumper's time of the last posting to prevent flood
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_lastpost_time = $current_time
+ WHERE user_id = " . $user->data['user_id'];
+ $db->sql_query($sql);
+
+ $db->sql_transaction('commit');
+
+ // Mark this topic as posted to
+ markread('post', $forum_id, $topic_id, $current_time);
+
+ // Mark this topic as read
+ markread('topic', $forum_id, $topic_id, $current_time);
+
+ // Update forum tracking info
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $sql = 'SELECT mark_time
+ FROM ' . FORUMS_TRACK_TABLE . '
+ WHERE user_id = ' . $user->data['user_id'] . '
+ AND forum_id = ' . $forum_id;
+ $result = $db->sql_query($sql);
+ $f_mark_time = (int) $db->sql_fetchfield('mark_time');
+ $db->sql_freeresult($result);
+ }
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ $f_mark_time = false;
+ }
+
+ if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ // Update forum info
+ $sql = 'SELECT forum_last_post_time
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . $forum_id;
+ $result = $db->sql_query($sql);
+ $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
+ $db->sql_freeresult($result);
+
+ update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false);
+ }
+
+ add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);
+
+ $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";
+
+ return $url;
+}
+
?>
\ No newline at end of file
diff --git a/phpBB/posting.php b/phpBB/posting.php
index f775699cee..89f2dfa2a6 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -321,35 +321,7 @@ if ($mode == 'bump')
if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id'])
&& check_link_hash(request_var('hash', ''), "topic_{$post_data['topic_id']}"))
{
- $db->sql_transaction('begin');
-
- $sql = 'UPDATE ' . POSTS_TABLE . "
- SET post_time = $current_time
- WHERE post_id = {$post_data['topic_last_post_id']}
- AND topic_id = $topic_id";
- $db->sql_query($sql);
-
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_last_post_time = $current_time,
- topic_bumped = 1,
- topic_bumper = " . $user->data['user_id'] . "
- WHERE topic_id = $topic_id";
- $db->sql_query($sql);
-
- update_post_information('forum', $forum_id);
-
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET user_lastpost_time = $current_time
- WHERE user_id = " . $user->data['user_id'];
- $db->sql_query($sql);
-
- $db->sql_transaction('commit');
-
- markread('post', $forum_id, $topic_id, $current_time);
-
- add_log('mod', $forum_id, $topic_id, 'LOG_BUMP_TOPIC', $post_data['topic_title']);
-
- $meta_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}";
+ $meta_url = bump_topic($forum_id, $topic_id, $post_data, $current_time);
meta_refresh(3, $meta_url);
$message = $user->lang['TOPIC_BUMPED'] . ' ' . sprintf($user->lang['VIEW_MESSAGE'], '', ' ');
--
cgit v1.2.1
From ac26bb458f2a2ea60848921826c69bfe03e676db Mon Sep 17 00:00:00 2001
From: Andreas Fischer
Date: Thu, 28 Oct 2010 21:41:14 +0200
Subject: [ticket/9764] Allow $config['mime_triggers'] to be an empty string.
explode('|', '') and explode('|', NULL) both return array(0 => '') which can
cause filespec::check_content() to reject everything starting with a '<'
character in case $config['mime_triggers'] is an empty string or not set.
fileupload::set_disallowed_content() now filters out empty strings by calling
array_diff() on the passed array, so setting $config['mime_triggers'] to an
empty string will turn off mime checking completely.
On the other side we want to fail safe if $config['mime_triggers'] is not set
at all. To do this, the array fileupload::$disallowed_content now contains some
default strings to be filtered out.
PHPBB3-9764
---
phpBB/includes/functions_posting.php | 2 +-
phpBB/includes/functions_upload.php | 4 ++--
phpBB/includes/functions_user.php | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6fd87db663..72331a73c6 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -388,7 +388,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx);
$upload = new fileupload();
- if ($config['check_attachment_content'])
+ if ($config['check_attachment_content'] && isset($config['mime_triggers']))
{
$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
}
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 7f09cc1640..d5bbd80242 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -458,7 +458,7 @@ class fileerror extends filespec
class fileupload
{
var $allowed_extensions = array();
- var $disallowed_content = array();
+ var $disallowed_content = array('body', 'head', 'html', 'img', 'plaintext', 'a href', 'pre', 'script', 'table', 'title');
var $max_filesize = 0;
var $min_width = 0;
var $min_height = 0;
@@ -539,7 +539,7 @@ class fileupload
{
if ($disallowed_content !== false && is_array($disallowed_content))
{
- $this->disallowed_content = $disallowed_content;
+ $this->disallowed_content = array_diff($disallowed_content, array(''));
}
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index f2c80705ba..90341cd926 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2080,7 +2080,7 @@ function avatar_upload($data, &$error)
// Init upload class
include_once($phpbb_root_path . 'includes/functions_upload.' . $phpEx);
- $upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), $config['avatar_filesize'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], explode('|', $config['mime_triggers']));
+ $upload = new fileupload('AVATAR_', array('jpg', 'jpeg', 'gif', 'png'), $config['avatar_filesize'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], (isset($config['mime_triggers']) ? explode('|', $config['mime_triggers']) : false));
if (!empty($_FILES['uploadfile']['name']))
{
--
cgit v1.2.1
From 87aa611a8e4b944ad3ba2cde1d3256570c5f45af Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Thu, 11 Nov 2010 11:49:17 +0100
Subject: [develop-olympus] Incrementing the version number to 3.0.9-dev.
---
phpBB/includes/constants.php | 4 ++--
phpBB/install/database_update.php | 2 +-
phpBB/install/schemas/schema_data.sql | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index a4635895b0..90440f74b8 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
*/
// phpBB Version
-define('PHPBB_VERSION', '3.0.8-RC1');
+define('PHPBB_VERSION', '3.0.9-dev');
// QA-related
// define('PHPBB_QA', 1);
@@ -275,4 +275,4 @@ define('ZEBRA_TABLE', $table_prefix . 'zebra');
// Additional tables
-?>
\ No newline at end of file
+?>
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 01e8ef7658..87a80f6a30 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-$updates_to_version = '3.0.8-RC1';
+$updates_to_version = '3.0.9-dev';
// Enter any version to update from to test updates. The version within the db will not be updated.
$debug_from_version = false;
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index cbee2c9ba1..355af802ef 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -242,7 +242,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.8-RC1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.9-dev');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
@@ -829,4 +829,4 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
-# POSTGRES COMMIT #
\ No newline at end of file
+# POSTGRES COMMIT #
--
cgit v1.2.1
From 396af3853fc2d86b255db0f71e56a9f880ee2509 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Thu, 11 Nov 2010 12:07:45 +0100
Subject: [develop-olympus] Remove accidentally added trailing newlines.
---
phpBB/includes/constants.php | 2 +-
phpBB/install/database_update.php | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 90440f74b8..2b19aa185d 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -275,4 +275,4 @@ define('ZEBRA_TABLE', $table_prefix . 'zebra');
// Additional tables
-?>
+?>
\ No newline at end of file
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 87a80f6a30..78d9067003 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-$updates_to_version = '3.0.9-dev';
+$updates_to_version = '3.0.8-RC1';
// Enter any version to update from to test updates. The version within the db will not be updated.
$debug_from_version = false;
@@ -477,7 +477,7 @@ else
- " class="button1">
+ " class="button1">
'[varchar] (255)',
'VARBINARY' => '[varchar] (255)',
),
-
+
'mssqlnative' => array(
'INT:' => '[int]',
'BINT' => '[float]',
@@ -2028,7 +2028,7 @@ class updater_db_tools
'VCHAR_CI' => '[varchar] (255)',
'VARBINARY' => '[varchar] (255)',
),
-
+
'oracle' => array(
'INT:' => 'number(%d)',
'BINT' => 'number(20)',
@@ -2175,7 +2175,7 @@ class updater_db_tools
case 'mssql_odbc':
$this->sql_layer = 'mssql';
break;
-
+
case 'mssqlnative':
$this->sql_layer = 'mssqlnative';
break;
@@ -3797,4 +3797,4 @@ class updater_db_tools
}
}
-?>
+?>
\ No newline at end of file
--
cgit v1.2.1
From b02cec86d40345f7ad28d0cca4e409766f0e65c2 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Thu, 11 Nov 2010 12:13:51 +0100
Subject: [develop-olympus] Revert accidental revert of db update lang fix and
version
Really not my day, is it?
---
phpBB/install/database_update.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 78d9067003..8d1755f8a6 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-$updates_to_version = '3.0.8-RC1';
+$updates_to_version = '3.0.9-dev';
// Enter any version to update from to test updates. The version within the db will not be updated.
$debug_from_version = false;
@@ -477,7 +477,7 @@ else
- " class="button1">
+ " class="button1">
Date: Sun, 21 Nov 2010 23:18:09 +0100
Subject: [ticket/9910] Make sure S_BBCODE_ALLOWED exists when viewing PMs
PHPBB3-9910
---
phpBB/includes/ucp/ucp_pm_viewmessage.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 16700c490c..b91636a9c8 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -172,6 +172,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
// Number of "to" recipients
$num_recipients = (int) preg_match_all('/:?(u|g)_([0-9]+):?/', $message_row['to_address'], $match);
+ $bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false;
+
$template->assign_vars(array(
'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),
'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']),
@@ -229,6 +231,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false,
'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)),
'S_PM_RECIPIENTS' => $num_recipients,
+ 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0,
'U_PRINT_PM' => ($config['print_pm'] && $auth->acl_get('u_pm_printpm')) ? "$url&f=$folder_id&p=" . $message_row['msg_id'] . "&view=print" : '',
'U_FORWARD_PM' => ($config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward')) ? "$url&mode=compose&action=forward&f=$folder_id&p=" . $message_row['msg_id'] : '')
--
cgit v1.2.1
From 7e934c6362a219bd3e9c11c6461bc6a32a9cf930 Mon Sep 17 00:00:00 2001
From: RMcGirr83
Date: Thu, 11 Nov 2010 18:50:08 -0500
Subject: [ticket/9897] A few language fixes
PHPBB3-9897
---
phpBB/language/en/acp/board.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 753decd517..5293b835d6 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -51,7 +51,7 @@ $lang = array_merge($lang, array(
'SITE_NAME' => 'Site name',
'SYSTEM_DST' => 'Enable Summer Time/DST ',
'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.',
+ '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 their 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.',
));
@@ -325,7 +325,7 @@ $lang = array_merge($lang, array(
'VISUAL_CONFIRM_REG' => 'Enable spambot countermeasures for registrations',
'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to pass the anti-spambot task to help prevent automated registrations.',
'VISUAL_CONFIRM_REFRESH' => 'Allow users to refresh the anti-spambot task',
- 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request a new anti-spambot task if they are unable to solve the currunt task during registration. Some plugins might not support this option.',
+ 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request a new anti-spambot task if they are unable to solve the current task during registration. Some plugins might not support this option.',
));
// Cookie Settings
@@ -394,7 +394,7 @@ $lang = array_merge($lang, array(
'LDAP_NO_EMAIL' => 'The specified e-mail attribute does not exist.',
'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.',
'LDAP_PASSWORD' => 'LDAP password',
- 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page. ',
+ 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding, otherwise fill in the password for the above user. Required for Active Directory Servers.Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page. ',
'LDAP_PORT' => 'LDAP server port',
'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.',
'LDAP_SERVER' => 'LDAP server name',
--
cgit v1.2.1
From 053cf790a93e9cfb521f484901d79c72783f868f Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Tue, 23 Nov 2010 16:09:09 +0100
Subject: [ticket/9924] Pass template instance into $template->display hook
PHPBB3-9924
---
phpBB/docs/hook_system.html | 2 ++
phpBB/includes/template.php | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html
index 1bf4630a9f..34055c4661 100644
--- a/phpBB/docs/hook_system.html
+++ b/phpBB/docs/hook_system.html
@@ -380,6 +380,8 @@ a:active { color: #368AD2; }
$template->display($handle, $include_once = true);
which is called directly before outputting the (not-yet-compiled) template.
exit_handler();
which is called at the very end of phpBB3's execution.
+There are also valid external constants you may want to use if you embed phpBB3 into your application:
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index f1c8094a9b..6347633b14 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -205,7 +205,7 @@ class template
{
global $user, $phpbb_hook;
- if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
+ if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))
{
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
{
--
cgit v1.2.1
From 5ec1c887959be5629c8a4c712b152d58058929a8 Mon Sep 17 00:00:00 2001
From: Joas Schilling
Date: Thu, 25 Nov 2010 23:29:12 +0100
Subject: [ticket/9930] Redirect failes with open_basedir enabled.
Open_basedir does not allow file_exists() for "." and directories without a
trayling-slash. Therefor we must append it on the check.
PHPBB3-9930
---
phpBB/includes/functions.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 561a9906c4..c7f19b709d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2353,12 +2353,12 @@ function redirect($url, $return = false, $disable_cd_check = false)
// Relative uri
$pathinfo = pathinfo($url);
- if (!$disable_cd_check && !file_exists($pathinfo['dirname']))
+ if (!$disable_cd_check && !file_exists($pathinfo['dirname'] . '/'))
{
$url = str_replace('../', '', $url);
$pathinfo = pathinfo($url);
- if (!file_exists($pathinfo['dirname']))
+ if (!file_exists($pathinfo['dirname'] . '/'))
{
// fallback to "last known user page"
// at least this way we know the user does not leave the phpBB root
--
cgit v1.2.1
From 23765fa6684ab8a4764ce944ac0469d2973eb12f Mon Sep 17 00:00:00 2001
From: Richard Foote
Date: Sun, 28 Nov 2010 13:32:35 +0100
Subject: [ticket/9932] Add the Bing bot when converting
PHPBB3-9932
---
phpBB/includes/functions_convert.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index 9e26043b39..4a359dcade 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1816,6 +1816,7 @@ function add_bots()
'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/', ''),
--
cgit v1.2.1
From 90ff30b7a08fa3c80314f12bf5bcf8ff23cf860b Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Tue, 23 Nov 2010 22:10:07 +0100
Subject: [task/github-readme] Add README file for GitHub
PHPBB3-9788
---
README.md | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..6b94f898a3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,20 @@
+[](http://www.phpbb.com)
+
+## ABOUT
+
+phpBB is a free bulletin board written in PHP.
+
+## COMMUNITY
+
+Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the development on [area51](http://area51.phpbb.com/phpBB/index.php).
+
+## CONTRIBUTE
+
+1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register)
+2. [Create a ticket (unless there already is one)](http://tracker.phpbb.com/secure/CreateIssue!default.jspa)
+3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git)
+4. Send us a pull request
+
+## LICENSE
+
+[GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php)
--
cgit v1.2.1
From b017f54ac9c923e74325f8cca96b11c6b684f115 Mon Sep 17 00:00:00 2001
From: Ingo Migliarina
Date: Wed, 1 Dec 2010 18:33:53 +0100
Subject: [ticket/9921] Adding sample configuration file for the lighttpd
webserver.
PHPBB3-9921
---
phpBB/docs/lighttpd.sample.conf | 60 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 phpBB/docs/lighttpd.sample.conf
diff --git a/phpBB/docs/lighttpd.sample.conf b/phpBB/docs/lighttpd.sample.conf
new file mode 100644
index 0000000000..5873d1c945
--- /dev/null
+++ b/phpBB/docs/lighttpd.sample.conf
@@ -0,0 +1,60 @@
+# Sample lighttpd configuration file for phpBB.
+# Global settings have been removed, copy them
+# from your system's lighttpd.conf.
+# Tested with lighttpd 1.4.26
+
+# Load moules
+server.modules += (
+ "mod_access",
+ "mod_fastcgi",
+ "mod_accesslog"
+)
+
+# If you have domains with and without www prefix,
+# redirect one to the other.
+$HTTP["host"] =~ "^(myforums\.com)$" {
+ url.redirect = (
+ ".*" => "http://www.%1$0"
+ )
+}
+
+$HTTP["host"] == "www.myforums.com" {
+ server.name = "www.myforums.com"
+ server.document-root = "/path/to/phpbb"
+ server.dir-listing = "disable"
+
+ index-file.names = ( "index.php", "index.htm", "index.html" )
+ accesslog.filename = "/var/log/lighttpd/access-www.myforums.com.log"
+
+ # Deny access to internal phpbb files.
+ $HTTP["url"] =~ "^/(config\.php|common\.php|includes|cache|files|store|images/avatars/upload)" {
+ url.access-deny = ( "" )
+ }
+
+ # Deny access to version control system directories.
+ $HTTP["url"] =~ "/\.svn|/\.git" {
+ url.access-deny = ( "" )
+ }
+
+ # Deny access to apache configuration files.
+ $HTTP["url"] =~ "/\.htaccess|/\.htpasswd|/\.htgroups" {
+ url.access-deny = ( "" )
+ }
+
+ fastcgi.server = ( ".php" =>
+ ((
+ "bin-path" => "/usr/bin/php-cgi",
+ "socket" => "/tmp/php.socket",
+ "max-procs" => 4,
+ "idle-timeout" => 30,
+ "bin-environment" => (
+ "PHP_FCGI_CHILDREN" => "10",
+ "PHP_FCGI_MAX_REQUESTS" => "10000"
+ ),
+ "bin-copy-environment" => (
+ "PATH", "SHELL", "USER"
+ ),
+ "broken-scriptfilename" => "enable"
+ ))
+ )
+}
--
cgit v1.2.1
From 8b3d068e8321a16451dddcef6da2cf1245506e55 Mon Sep 17 00:00:00 2001
From: Adam Reyher
Date: Wed, 1 Dec 2010 14:14:46 -0500
Subject: [ticket/9575] Change 'administrate' to 'administer'
PHPBB3-9575
---
phpBB/language/en/acp/common.php | 2 +-
phpBB/language/en/acp/groups.php | 2 +-
phpBB/language/en/memberlist.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 2c549f8130..8c71e936b3 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -255,7 +255,7 @@ $lang = array_merge($lang, array(
'MOVE_UP' => 'Move up',
'NOTIFY' => 'Notification',
- 'NO_ADMIN' => 'You are not authorised to administrate this board.',
+ 'NO_ADMIN' => 'You are not authorised to administer this board.',
'NO_EMAILS_DEFINED' => 'No valid e-mail addresses found.',
'NO_PASSWORD_SUPPLIED' => 'You need to enter your password to access the Administration Control Panel.',
diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php
index e8c1a3c494..3444b98303 100644
--- a/phpBB/language/en/acp/groups.php
+++ b/phpBB/language/en/acp/groups.php
@@ -36,7 +36,7 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
- 'ACP_GROUPS_MANAGE_EXPLAIN' => 'From this panel you can administrate all your usergroups. You can delete, create and edit existing groups. Furthermore, you may choose group leaders, toggle open/hidden/closed group status and set the group name and description.',
+ 'ACP_GROUPS_MANAGE_EXPLAIN' => 'From this panel you can administer all your usergroups. You can delete, create and edit existing groups. Furthermore, you may choose group leaders, toggle open/hidden/closed group status and set the group name and description.',
'ADD_USERS' => 'Add users',
'ADD_USERS_EXPLAIN' => 'Here you can add new users to the group. You may select whether this group becomes the new default for the selected users. Additionally you can define them as group leaders. Please enter each username on a separate line.',
diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php
index e7a9c6b88d..213f766610 100644
--- a/phpBB/language/en/memberlist.php
+++ b/phpBB/language/en/memberlist.php
@@ -131,7 +131,7 @@ $lang = array_merge($lang, array(
'SORT_POST_COUNT' => 'Post count',
'USERNAME_BEGINS_WITH' => 'Username begins with',
- 'USER_ADMIN' => 'Administrate user',
+ 'USER_ADMIN' => 'Administer user',
'USER_BAN' => 'Banning',
'USER_FORUM' => 'User statistics',
'USER_LAST_REMINDED' => array(
--
cgit v1.2.1
From e6a6f00562953f507bb05f4c61d40a0800f70bff Mon Sep 17 00:00:00 2001
From: Adam Reyher
Date: Wed, 1 Dec 2010 14:29:28 -0500
Subject: [ticket/9928] Do not link "login to your board" to the "send
statistics" page.
PHPBB3-9928
---
phpBB/language/en/install.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 14923e836e..91ecb10848 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -370,7 +370,7 @@ $lang = array_merge($lang, array(
// Updater
$lang = array_merge($lang, array(
- 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.',
+ 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.',
'ARCHIVE_FILE' => 'Source file within archive',
'BACK' => 'Back',
--
cgit v1.2.1
From 7a3d6a8168c7cd7da4f3ff462579ed562d0432a1 Mon Sep 17 00:00:00 2001
From: RMcGirr83
Date: Mon, 29 Nov 2010 07:10:19 -0500
Subject: [ticket/8736] guest can have 255 chars long username
when you post as a guest (anonymous) you can fill the field username with 255
chars. that will destroy the prosilver and subsilver2 style at viewtopic.
settings for username in ACP: 6-16 Chars
PHPBB3-8736
---
phpBB/posting.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/phpBB/posting.php b/phpBB/posting.php
index f775699cee..7368026136 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -861,11 +861,18 @@ if ($submit || $preview || $refresh)
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ $user->add_lang('ucp');
+
if (($result = validate_username($post_data['username'], (!empty($post_data['post_username'])) ? $post_data['post_username'] : '')) !== false)
{
- $user->add_lang('ucp');
$error[] = $user->lang[$result . '_USERNAME'];
}
+
+ if (($result = validate_string($post_data['username'], false, $config['min_name_chars'], $config['max_name_chars'])) !== false)
+ {
+ $min_max_amount = ($result == 'TOO_SHORT') ? $config['min_name_chars'] : $config['max_name_chars'];
+ $error[] = sprintf($user->lang['FIELD_' . $result], $user->lang['USERNAME'], $min_max_amount);
+ }
}
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
--
cgit v1.2.1
From 0491bfbc2d5e7d98a7a15b5d0096c2647b821709 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Sun, 5 Dec 2010 14:09:39 +0100
Subject: [ticket/9575] Also change 'administrate' to 'administer' in templates
PHPBB3-9575
---
phpBB/adm/style/acp_forums.html | 2 +-
phpBB/adm/style/acp_styles.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 9f9216a068..d27cea28f7 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -58,7 +58,7 @@
/**
* Init the wanted display functionality if javascript is enabled.
- * If javascript is not available, the user is still able to properly administrate.
+ * If javascript is not available, the user is still able to properly administer.
*/
onload = function()
{
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html
index 5bde4008ad..cb4361dd6f 100644
--- a/phpBB/adm/style/acp_styles.html
+++ b/phpBB/adm/style/acp_styles.html
@@ -77,7 +77,7 @@
/**
* Init the wanted display functionality if javascript is enabled.
- * If javascript is not available, the user is still able to properly administrate.
+ * If javascript is not available, the user is still able to properly administer.
*/
onload = function()
{
--
cgit v1.2.1
From 7dd06e8113d4a571d8681a9a11f2b06ca7a7beb8 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Sun, 5 Dec 2010 14:35:19 +0100
Subject: [ticket/9939] Fix JavaScript error in admin recaptcha template
PHPBB3-9939
---
phpBB/adm/style/captcha_recaptcha.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html
index 586c494868..d3038fd714 100644
--- a/phpBB/adm/style/captcha_recaptcha.html
+++ b/phpBB/adm/style/captcha_recaptcha.html
@@ -5,7 +5,7 @@
//
--
cgit v1.2.1
From d7287ec633577886e5f92543c2a610d4aaa93d53 Mon Sep 17 00:00:00 2001
From: ChrisTX
Date: Sun, 21 Nov 2010 23:02:56 +0100
Subject: [feature/acm-wincache] Adding caching module for WinCache's User
Cache.
PHPBB3-9942
---
phpBB/includes/acm/acm_wincache.php | 84 +++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 phpBB/includes/acm/acm_wincache.php
diff --git a/phpBB/includes/acm/acm_wincache.php b/phpBB/includes/acm/acm_wincache.php
new file mode 100644
index 0000000000..0501ab74c5
--- /dev/null
+++ b/phpBB/includes/acm/acm_wincache.php
@@ -0,0 +1,84 @@
+key_prefix . $var, $success);
+
+ return ($success) ? $result : false;
+ }
+
+ /**
+ * Store data in the cache
+ *
+ * @access protected
+ * @param string $var Cache key
+ * @param mixed $data Data to store
+ * @param int $ttl Time-to-live of cached data
+ * @return bool True if the operation succeeded
+ */
+ function _write($var, $data, $ttl = 2592000)
+ {
+ return wincache_ucache_set($this->key_prefix . $var, $data, $ttl);
+ }
+
+ /**
+ * Remove an item from the cache
+ *
+ * @access protected
+ * @param string $var Cache key
+ * @return bool True if the operation succeeded
+ */
+ function _delete($var)
+ {
+ return wincache_ucache_delete($this->key_prefix . $var);
+ }
+}
--
cgit v1.2.1
From 41184e5d7621d19f8349facb9c1cc9217ae7189e Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Mon, 13 Dec 2010 14:21:32 +0100
Subject: [task/phpdoc] Added a configuration file for phpDocumentor.
PHPBB3-9943
---
build/phpdoc-phpbb.ini | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
create mode 100644 build/phpdoc-phpbb.ini
diff --git a/build/phpdoc-phpbb.ini b/build/phpdoc-phpbb.ini
new file mode 100644
index 0000000000..86d33549c0
--- /dev/null
+++ b/build/phpdoc-phpbb.ini
@@ -0,0 +1,106 @@
+;; phpDocumentor parse configuration file
+;;
+;; This file is designed to cut down on repetitive typing on the command-line or web interface
+;; You can copy this file to create a number of configuration files that can be used with the
+;; command-line switch -c, as in phpdoc -c default.ini or phpdoc -c myini.ini. The web
+;; interface will automatically generate a list of .ini files that can be used.
+;;
+;; default.ini is used to generate the online manual at http://www.phpdoc.org/docs
+;;
+;; ALL .ini files must be in the user subdirectory of phpDocumentor with an extension of .ini
+;;
+;; Copyright 2002, Greg Beaver
+;;
+;; WARNING: do not change the name of any command-line parameters, phpDocumentor will ignore them
+
+[Parse Data]
+;; title of all the documentation
+;; legal values: any string
+title = phpBB3 Sourcecode Documentation
+
+;; parse files that start with a . like .bash_profile
+;; legal values: true, false
+hidden = false
+
+;; show elements marked @access private in documentation by setting this to on
+;; legal values: on, off
+parseprivate = on
+
+;; parse with javadoc-like description (first sentence is always the short description)
+;; legal values: on, off
+javadocdesc = off
+
+;; add any custom @tags separated by commas here
+;; legal values: any legal tagname separated by commas.
+;customtags = mytag1,mytag2
+
+;; This is only used by the XML:DocBook/peardoc2 converter
+defaultcategoryname = sourcecode
+
+;; what is the main package?
+;; legal values: alphanumeric string plus - and _
+defaultpackagename = phpBB3
+
+;; output any parsing information? set to on for cron jobs
+;; legal values: on
+;quiet = on
+
+;; parse a PEAR-style repository. Do not turn this on if your project does
+;; not have a parent directory named "pear"
+;; legal values: on/off
+;pear = on
+
+;; where should the documentation be written?
+;; legal values: a legal path
+target = api
+
+;; Which files should be parsed out as special documentation files, such as README,
+;; INSTALL and CHANGELOG? This overrides the default files found in
+;; phpDocumentor.ini (this file is not a user .ini file, but the global file)
+readmeinstallchangelog = README.html, INSTALL.html, CHANGELOG.html, COPYING
+
+;; limit output to the specified packages, even if others are parsed
+;; legal values: package names separated by commas
+;packageoutput = phpBB3,ACP,SEARCH,DBAL,ACM,MCP,UCP,LOGIN,lang_english
+
+;; comma-separated list of files to parse
+;; legal values: paths separated by commas
+;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory
+
+;; comma-separated list of directories to parse
+;; legal values: directory paths separated by commas
+;directory = /path1,/path2,.,..,subdirectory
+;directory = /home/jeichorn/cvs/pear
+directory = ../phpBB/
+
+;; template base directory (the equivalent directory of /phpDocumentor)
+;templatebase = /path/to/my/templates
+
+;; directory to find any example files in through @example and {@example} tags
+;examplesdir = c:\wamp\www\examples
+
+;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore
+;; legal values: any wildcard strings separated by commas
+;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/
+ignore = templates_c/,*HTML/default/*,spec/,*config.php*,*CVS/,test_chora.php,testupdate/,cache/,store/,*proSilver/,develop/,includes/utf/data/,includes/captcha/fonts/,install/update/,install/update.new/,files/,*phpinfo.php*,*update_script.php*,*upgrade.php*,*convert.php*,install/converter/,language/de/,script/,*swatch.php*,*test.php*,*test2.php*,*install.php*,*functions_diff.php*,*acp_update.php*
+
+;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format
+;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,
+;; HTML:frames:earthli,
+;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,
+;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli
+;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS
+;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default
+;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS,CHM:default:default,PDF:default:default
+;output=HTML:frames:DOM/default,XML:DocBook/peardoc2:default,CHM:default:default,HTML:frames:DOM/earthli,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/phphtmllib,HTML:frames:phphtmllib
+;HTML:frames:earthli
+;output=XML:DocBook/peardoc2:default
+
+;output=HTML:frames:DOM/earthli
+;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS,CHM:default:default,PDF:default:default
+;output=HTML:Smarty:PHP
+output=HTML:frames:earthli
+
+;; turn this option on if you want highlighted source code for every file
+;; legal values: on/off
+sourcecode = off
--
cgit v1.2.1
From 03c52e79b909158a1461bc1c6a48b44fd4a2a97a Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Mon, 13 Dec 2010 14:24:33 +0100
Subject: [task/phpdoc] Added a phpdoc task to the build process
PHPBB3-9943
---
build/build.xml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/build/build.xml b/build/build.xml
index bf77d82f6c..8d2afcb00c 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -12,7 +12,7 @@
-
+
@@ -64,6 +64,12 @@
-->
+
+
+
+
--
cgit v1.2.1
From b88582199d09931e23b939784fc266fbc0473d30 Mon Sep 17 00:00:00 2001
From: rxu
Date: Sun, 17 Oct 2010 15:42:13 +0800
Subject: [ticket/9851] "Search new posts" should require login.
The newposts search uses user_lastvisit, so it should require user to log in.
PHPBB3-9851
---
phpBB/language/en/search.php | 1 +
phpBB/search.php | 56 +++++++++++++++++++++++++++-----------------
2 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php
index d93fe6b56a..cd38cd615f 100644
--- a/phpBB/language/en/search.php
+++ b/phpBB/language/en/search.php
@@ -54,6 +54,7 @@ $lang = array_merge($lang, array(
'LOGIN_EXPLAIN_EGOSEARCH' => 'The board requires you to be registered and logged in to view your own posts.',
'LOGIN_EXPLAIN_UNREADSEARCH'=> 'The board requires you to be registered and logged in to view your unread posts.',
+ 'LOGIN_EXPLAIN_NEWPOSTS' => 'The board requires you to be registered and logged in to view new posts since your last visit.',
'MAX_NUM_SEARCH_KEYWORDS_REFINE' => 'You specified too many words to search for. Please do not enter more than %1$d words.',
diff --git a/phpBB/search.php b/phpBB/search.php
index 2a13e20477..2aa61401cf 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -47,32 +47,44 @@ $sort_dir = request_var('sd', 'd');
$return_chars = request_var('ch', ($topic_id) ? -1 : 300);
$search_forum = request_var('fid', array(0));
-// We put login boxes for the case if search_id is egosearch or unreadposts
+// We put login boxes for the case if search_id is newposts, egosearch or unreadposts
// because a guest should be able to log in even if guests search is not permitted
-// Egosearch is an author search
-if ($search_id == 'egosearch')
+switch ($search_id)
{
- $author_id = $user->data['user_id'];
-
- if ($user->data['user_id'] == ANONYMOUS)
- {
- login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']);
- }
-}
+ // Egosearch is an author search
+ case 'egosearch':
+ $author_id = $user->data['user_id'];
+ if ($user->data['user_id'] == ANONYMOUS)
+ {
+ login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']);
+ }
+ break;
-// Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled
-if ($search_id == 'unreadposts')
-{
- if (!$config['load_unreads_search'])
- {
- $template->assign_var('S_NO_SEARCH', true);
- trigger_error('NO_SEARCH_UNREADS');
- }
- else if (!$config['load_anon_lastread'] && !$user->data['is_registered'])
- {
- login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
- }
+ // Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled
+ case 'unreadposts':
+ if (!$config['load_unreads_search'])
+ {
+ $template->assign_var('S_NO_SEARCH', true);
+ trigger_error('NO_SEARCH_UNREADS');
+ }
+ else if (!$config['load_anon_lastread'] && !$user->data['is_registered'])
+ {
+ login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
+ }
+ break;
+
+ // The "new posts" search uses user_lastvisit which is user based, so it should require user to log in.
+ case 'newposts':
+ if ($user->data['user_id'] == ANONYMOUS)
+ {
+ login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']);
+ }
+ break;
+
+ default:
+ // There's nothing to do here for now ;)
+ break;
}
// Is user able to search? Has search been disabled?
--
cgit v1.2.1
From e4488fe78819b5dd7b1e7edd8c8defe07d264b37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?=
Date: Wed, 15 Dec 2010 09:39:28 +0100
Subject: [ticket/9948] Inline quicktime files won't show
When attaching a quicktime file and placing it
inline the movie won't be shown due to the size
the movie box is being given.
PHPBB3-9948
---
phpBB/styles/prosilver/template/attachment.html | 4 ++--
phpBB/styles/subsilver2/template/attachment.html | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/phpBB/styles/prosilver/template/attachment.html b/phpBB/styles/prosilver/template/attachment.html
index cc5aacff2f..4c0a326f1e 100644
--- a/phpBB/styles/prosilver/template/attachment.html
+++ b/phpBB/styles/prosilver/template/attachment.html
@@ -70,12 +70,12 @@
-
+
-
+
diff --git a/phpBB/styles/subsilver2/template/attachment.html b/phpBB/styles/subsilver2/template/attachment.html
index 833bd4d55f..b5b547b2e6 100644
--- a/phpBB/styles/subsilver2/template/attachment.html
+++ b/phpBB/styles/subsilver2/template/attachment.html
@@ -67,12 +67,12 @@
-
+
-
+
--
cgit v1.2.1
From fc9516a2e3e4b039b8f4f07604b6914a54a71757 Mon Sep 17 00:00:00 2001
From: Andreas Fischer
Date: Thu, 16 Dec 2010 01:19:40 +0100
Subject: [ticket/9859] Remove years from the credit line.
PHPBB3-9859
---
phpBB/styles/prosilver/template/overall_footer.html | 2 +-
phpBB/styles/subsilver2/template/overall_footer.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index 4da1308e14..aeb6dc9ba3 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -30,7 +30,7 @@
The phpBB Group : 2006
//-->
- Powered by
phpBB © 2000, 2002, 2005, 2007 phpBB Group
+
Powered by
phpBB © phpBB Group
{TRANSLATION_INFO}
{DEBUG_OUTPUT}
{L_ACP}
diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html
index 64201ff2b9..187d0f4366 100644
--- a/phpBB/styles/subsilver2/template/overall_footer.html
+++ b/phpBB/styles/subsilver2/template/overall_footer.html
@@ -14,7 +14,7 @@
--
cgit v1.2.1
From d1cf7ff24a3d6da8de9aff89d1c371aa69510353 Mon Sep 17 00:00:00 2001
From: Marc Alexander
Date: Sun, 19 Dec 2010 17:31:02 +0100
Subject: [ticket/9925] prosilver logo margin bug in IE 6-7-8
PHPBB3-9925
---
phpBB/styles/prosilver/theme/tweaks.css | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css
index 782e682b9d..30fe5fb986 100644
--- a/phpBB/styles/prosilver/theme/tweaks.css
+++ b/phpBB/styles/prosilver/theme/tweaks.css
@@ -90,3 +90,12 @@ dl.icon {
* html .forumbg table.table1 {
margin: 0 -2px 0px -1px;
}
+
+/* Headerbar height fix for IE7 and below */
+* html #site-description p {
+ margin-bottom: 1.0em;
+}
+
+*:first-child+html #site-description p {
+ margin-bottom: 1.0em;
+}
\ No newline at end of file
--
cgit v1.2.1
From 8a07e8a4f8092e0123f16e9b4acf15d7d54d4c24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Fr=C3=A8rejean?=
Date: Tue, 21 Dec 2010 15:08:07 +0100
Subject: [ticket/9954] Remove unneeded never permission
The `ROLE_USER_NOAVATAR` role gets a *never* permission assigned
for the two "u_masspm*" permissions. Due to this, this role changes
behaviour it isn't intended to change. It should assign "no" as is
done in the `ROLE_USER_LIMITED` role.
PHPBB3-9954
---
phpBB/install/schemas/schema_data.sql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 355af802ef..700d4d63d1 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -565,7 +565,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
# No Avatar (u_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar', 'u_masspm', 'u_masspm_group');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar');
# Full Moderator (m_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 10, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%';
--
cgit v1.2.1
From 3f27cb2ea78dd571591db6d0886395f313c9fe5e Mon Sep 17 00:00:00 2001
From: RMcGirr83
Date: Mon, 20 Dec 2010 07:58:37 -0500
Subject: [ticket/9937] The feed icon displays on External links...which we
don't want
PHPBB3-9937
---
phpBB/includes/functions_display.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 2de7e1b169..7989b74c55 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
- 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options'])) ? true : false,
+ 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] != FORUM_LINK) ? true : false,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
--
cgit v1.2.1
From cdbb609c2002cc5db5953bc89d46696aa9bdd069 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Tue, 21 Dec 2010 22:44:10 +0100
Subject: [ticket/9937] Make sure feed icon only shows for FORUM_POST
This is cleaner, since feed.php only supports FORUM_POST.
PHPBB3-9937
---
phpBB/includes/functions_display.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 7989b74c55..acaef49fe8 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
- 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] != FORUM_LINK) ? true : false,
+ 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
--
cgit v1.2.1
From 4c076bfdc1890cfdd7cfdba606db77142ae86467 Mon Sep 17 00:00:00 2001
From: Patrick Webster
Date: Sun, 19 Dec 2010 17:48:12 -0600
Subject: [ticket/9905] Add SQLite to the DSN description
The installer's DSN field has additional meanings for ODBC, PostgreSQL, and
SQLite, but only the first two are mentioned. SQLite uses it for the file path.
PHPBB3-9905
---
phpBB/language/en/install.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 91ecb10848..11c5d78359 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -128,7 +128,7 @@ $lang = array_merge($lang, array(
'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first , %s (“%s”).',
'DB_ERR_SELECT' => 'Error while running SELECT
query.',
'DB_HOST' => 'Database server hostname or DSN',
- 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP.',
+ 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.',
'DB_NAME' => 'Database name',
'DB_PASSWORD' => 'Database password',
'DB_PORT' => 'Database server port',
--
cgit v1.2.1
From 7f0f08bcc497d04746b209510a55ebfadcfe13bb Mon Sep 17 00:00:00 2001
From: Patrick Webster
Date: Sun, 19 Dec 2010 20:43:35 -0600
Subject: [ticket/9953] Set focus to password on re-authentication
Sets the login focus to the password field when prompting for admin
re-authentication, rather than the username field.
PHPBB3-9953
---
phpBB/styles/prosilver/template/login_body.html | 2 +-
phpBB/styles/subsilver2/template/login_body.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html
index 26e425a1d0..36c2eae349 100644
--- a/phpBB/styles/prosilver/template/login_body.html
+++ b/phpBB/styles/prosilver/template/login_body.html
@@ -2,7 +2,7 @@
diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html
index 90bbf8c139..262341e0c0 100644
--- a/phpBB/styles/subsilver2/template/login_body.html
+++ b/phpBB/styles/subsilver2/template/login_body.html
@@ -92,7 +92,7 @@
// {PASSWORD_CREDENTIAL}{USERNAME_CREDENTIAL}");
for (var i = 0; i < elements.length; ++i)
{
if (elements[i].tagName.toLowerCase() == 'input')
--
cgit v1.2.1
From 90c8803d59f05038ba1546c3976d8bddccc389f4 Mon Sep 17 00:00:00 2001
From: Richard Foote
Date: Tue, 28 Dec 2010 21:33:34 +0100
Subject: [ticket/9348] Call phpbb_set_encoding() on config value
'default_dateformat'.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Call phpbb_set_encoding() on 'default_dateformat' to properly re-encode
non-ascii characters that might be in default_dateformat.
E.g. "d M Y à H:i"
PHPBB3-9348
---
phpBB/install/convertors/convert_phpbb20.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index efe2bc2962..b6eee8d621 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -134,7 +134,7 @@ $config_schema = array(
'avatar_filesize' => 'avatar_filesize',
'avatar_max_width' => 'avatar_max_width',
'avatar_max_height' => 'avatar_max_height',
- 'default_dateformat' => 'default_dateformat',
+ 'default_dateformat' => 'phpbb_set_encoding(default_dateformat)',
'board_timezone' => 'board_timezone',
'allow_privmsg' => 'not(privmsg_disable)',
'gzip_compress' => 'gzip_compress',
--
cgit v1.2.1
From 9a52bd030189280f48a35d3b9e52f9d77071cb5e Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Mon, 3 Jan 2011 22:21:54 +0100
Subject: [task/phpunit-xml] Use phpunit.xml for test suite
PHPBB3-9967
---
.gitignore | 1 +
build/build.xml | 11 ++-
phpunit.xml.dist | 34 +++++++++
tests/RUNNING_TESTS.txt | 8 +--
tests/all_tests.php | 69 ------------------
tests/bootstrap.php | 30 ++++++++
tests/dbal/all_tests.php | 42 -----------
tests/dbal/select.php | 3 +-
tests/dbal/write.php | 3 +-
tests/network/all_tests.php | 40 -----------
tests/network/checkdnsrr.php | 3 +-
tests/random/all_tests.php | 40 -----------
tests/random/gen_rand_string.php | 3 +-
tests/regex/all_tests.php | 46 ------------
tests/regex/email.php | 3 +-
tests/regex/ipv4.php | 3 +-
tests/regex/ipv6.php | 3 +-
tests/regex/url.php | 3 +-
tests/request/all_tests.php | 41 -----------
tests/request/request_var.php | 3 +-
tests/security/all_tests.php | 86 -----------------------
tests/security/base.php | 54 ++++++++++++++
tests/security/extract_current_page.php | 8 +--
tests/security/redirect.php | 12 ++--
tests/template/all_tests.php | 40 -----------
tests/template/template.php | 4 +-
tests/template/templates/_dummy_include.php | 3 -
tests/template/templates/_dummy_include.php.inc | 3 +
tests/template/templates/includephp.html | 2 +-
tests/test_framework/framework.php | 43 ------------
tests/test_framework/phpbb_database_test_case.php | 10 +--
tests/text_processing/all_tests.php | 41 -----------
tests/text_processing/make_clickable.php | 6 +-
tests/utf/all_tests.php | 43 ------------
tests/utf/utf8_clean_string_test.php | 3 +-
tests/utf/utf8_wordwrap_test.php | 3 +-
36 files changed, 162 insertions(+), 588 deletions(-)
create mode 100644 phpunit.xml.dist
delete mode 100644 tests/all_tests.php
create mode 100644 tests/bootstrap.php
delete mode 100644 tests/dbal/all_tests.php
delete mode 100644 tests/network/all_tests.php
delete mode 100644 tests/random/all_tests.php
delete mode 100644 tests/regex/all_tests.php
delete mode 100644 tests/request/all_tests.php
delete mode 100644 tests/security/all_tests.php
create mode 100644 tests/security/base.php
delete mode 100644 tests/template/all_tests.php
delete mode 100644 tests/template/templates/_dummy_include.php
create mode 100644 tests/template/templates/_dummy_include.php.inc
delete mode 100644 tests/test_framework/framework.php
delete mode 100644 tests/text_processing/all_tests.php
delete mode 100644 tests/utf/all_tests.php
diff --git a/.gitignore b/.gitignore
index 871d17b386..39b9e0a7f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*~
+phpunit.xml
phpBB/cache/*.php
phpBB/config.php
phpBB/files/*
diff --git a/build/build.xml b/build/build.xml
index 8d2afcb00c..8321edf374 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -42,12 +42,11 @@
-
-
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000000..e3416c6db3
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,34 @@
+
+
+
+
+
+ ./tests/
+
+
+
+
+
+ ./tests/
+ ./phpBB/
+
+
+ ./phpBB/includes/db/
+ ./phpBB/includes/utf/utf_tools.php
+ ./phpBB/includes/functions.php
+ ./phpBB/includes/functions_content.php
+ ./phpBB/includes/session.php
+ ./phpBB/includes/template.php
+
+
+
diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt
index 74a0635c1a..ac07978d3e 100644
--- a/tests/RUNNING_TESTS.txt
+++ b/tests/RUNNING_TESTS.txt
@@ -7,7 +7,7 @@ Prerequisites
PHPUnit
-------
-phpBB unit tests use PHPUnit framework. Version 3.3 or better is required
+phpBB unit tests use PHPUnit framework. Version 3.5 or better is required
to run the tests. PHPUnit prefers to be installed via PEAR; refer to
http://www.phpunit.de/ for more information.
@@ -41,14 +41,14 @@ will run phpunit with the same parameters as in the shown test_config.php file:
$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
PHPBB_TEST_DBNAME='database' PHPBB_TEST_DBUSER='user' \
- PHPBB_TEST_DBPASSWD='password' phpunit all_tests.php
+ PHPBB_TEST_DBPASSWD='password' phpunit
Running
=======
-Once the prerequisites are installed, run the tests from tests directory:
+Once the prerequisites are installed, run the tests from the project root directory (above phpBB):
- $ phpunit all_tests.php
+ $ phpunit
More Information
================
diff --git a/tests/all_tests.php b/tests/all_tests.php
deleted file mode 100644
index d1d711c4d7..0000000000
--- a/tests/all_tests.php
+++ /dev/null
@@ -1,69 +0,0 @@
-= 0)
-{
- PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('./');
-}
-else
-{
- PHPUnit_Util_Filter::addDirectoryToFilter('./');
-}
-
-class phpbb_all_tests
-{
- public static function main()
- {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite()
- {
- $suite = new PHPUnit_Framework_TestSuite('phpBB');
-
- $suite->addTest(phpbb_utf_all_tests::suite());
- $suite->addTest(phpbb_request_all_tests::suite());
- $suite->addTest(phpbb_security_all_tests::suite());
- $suite->addTest(phpbb_template_all_tests::suite());
- $suite->addTest(phpbb_text_processing_all_tests::suite());
- $suite->addTest(phpbb_dbal_all_tests::suite());
- $suite->addTest(phpbb_regex_all_tests::suite());
- $suite->addTest(phpbb_network_all_tests::suite());
- $suite->addTest(phpbb_random_all_tests::suite());
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_all_tests::main')
-{
- phpbb_all_tests::main();
-}
-
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 0000000000..9683ba0d47
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1,30 @@
+= 6.0.0 we do not need some code
+if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
+{
+ define('STRIP', false);
+}
+else
+{
+ @set_magic_quotes_runtime(0);
+ define('STRIP', (get_magic_quotes_gpc()) ? true : false);
+}
+
+require_once $phpbb_root_path . 'includes/constants.php';
+
+require_once 'test_framework/phpbb_test_case_helpers.php';
+require_once 'test_framework/phpbb_test_case.php';
+require_once 'test_framework/phpbb_database_test_case.php';
diff --git a/tests/dbal/all_tests.php b/tests/dbal/all_tests.php
deleted file mode 100644
index cfa8176246..0000000000
--- a/tests/dbal/all_tests.php
+++ /dev/null
@@ -1,42 +0,0 @@
-addTestSuite('phpbb_dbal_select_test');
- $suite->addTestSuite('phpbb_dbal_write_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_dbal_all_tests::main')
-{
- phpbb_dbal_all_tests::main();
-}
diff --git a/tests/dbal/select.php b/tests/dbal/select.php
index 70f27549d2..987de5cbff 100644
--- a/tests/dbal/select.php
+++ b/tests/dbal/select.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_dbal_select_test extends phpbb_database_test_case
{
diff --git a/tests/dbal/write.php b/tests/dbal/write.php
index 01deacda69..a24b6efcc4 100644
--- a/tests/dbal/write.php
+++ b/tests/dbal/write.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_dbal_write_test extends phpbb_database_test_case
{
diff --git a/tests/network/all_tests.php b/tests/network/all_tests.php
deleted file mode 100644
index b500647f81..0000000000
--- a/tests/network/all_tests.php
+++ /dev/null
@@ -1,40 +0,0 @@
-addTestSuite('phpbb_network_checkdnsrr_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_network_all_tests::main')
-{
- phpbb_network_all_tests::main();
-}
diff --git a/tests/network/checkdnsrr.php b/tests/network/checkdnsrr.php
index 57fe2761cc..427132e508 100644
--- a/tests/network/checkdnsrr.php
+++ b/tests/network/checkdnsrr.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_network_checkdnsrr_test extends phpbb_test_case
{
diff --git a/tests/random/all_tests.php b/tests/random/all_tests.php
deleted file mode 100644
index c6ffe78024..0000000000
--- a/tests/random/all_tests.php
+++ /dev/null
@@ -1,40 +0,0 @@
-addTestSuite('phpbb_random_gen_rand_string_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_random_all_tests::main')
-{
- phpbb_random_all_tests::main();
-}
diff --git a/tests/random/gen_rand_string.php b/tests/random/gen_rand_string.php
index cd58d14ed3..fa519f134c 100644
--- a/tests/random/gen_rand_string.php
+++ b/tests/random/gen_rand_string.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_random_gen_rand_string_test extends phpbb_test_case
{
diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php
deleted file mode 100644
index 316a9d4a58..0000000000
--- a/tests/regex/all_tests.php
+++ /dev/null
@@ -1,46 +0,0 @@
-addTestSuite('phpbb_regex_email_test');
- $suite->addTestSuite('phpbb_regex_ipv4_test');
- $suite->addTestSuite('phpbb_regex_ipv6_test');
- $suite->addTestSuite('phpbb_regex_url_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_regex_all_tests::main')
-{
- phpbb_regex_all_tests::main();
-}
diff --git a/tests/regex/email.php b/tests/regex/email.php
index 8658b8af36..5d6e207cbb 100644
--- a/tests/regex/email.php
+++ b/tests/regex/email.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_regex_email_test extends phpbb_test_case
{
diff --git a/tests/regex/ipv4.php b/tests/regex/ipv4.php
index 9d131ad0ca..735a2c4384 100644
--- a/tests/regex/ipv4.php
+++ b/tests/regex/ipv4.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_regex_ipv4_test extends phpbb_test_case
{
diff --git a/tests/regex/ipv6.php b/tests/regex/ipv6.php
index 3d7a72e492..187588f861 100644
--- a/tests/regex/ipv6.php
+++ b/tests/regex/ipv6.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_regex_ipv6_test extends phpbb_test_case
{
diff --git a/tests/regex/url.php b/tests/regex/url.php
index 678b7d108f..246cbf549c 100644
--- a/tests/regex/url.php
+++ b/tests/regex/url.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_regex_url_test extends phpbb_test_case
{
diff --git a/tests/request/all_tests.php b/tests/request/all_tests.php
deleted file mode 100644
index 1ee3029b36..0000000000
--- a/tests/request/all_tests.php
+++ /dev/null
@@ -1,41 +0,0 @@
-addTestSuite('phpbb_request_request_var_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_request_all_tests::main')
-{
- phpbb_request_all_tests::main();
-}
-
diff --git a/tests/request/request_var.php b/tests/request/request_var.php
index b1dacef3fd..804e5d6390 100644
--- a/tests/request/request_var.php
+++ b/tests/request/request_var.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
class phpbb_request_request_var_test extends phpbb_test_case
{
diff --git a/tests/security/all_tests.php b/tests/security/all_tests.php
deleted file mode 100644
index 8e3916733f..0000000000
--- a/tests/security/all_tests.php
+++ /dev/null
@@ -1,86 +0,0 @@
- gzip,deflate
- [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
- DOCUMENT_ROOT] => /var/www/
- [SCRIPT_FILENAME] => /var/www/tests/index.php
-*/
-
- // Set no user and trick a bit to circumvent errors
- $user = new user();
- $user->lang = true;
- $user->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
- $user->referer = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : '';
- $user->forwarded_for = (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? (string) $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
- $user->host = (!empty($_SERVER['HTTP_HOST'])) ? (string) strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
- $user->page = session::extract_current_page($phpbb_root_path);
- }
-
- protected function tearDown()
- {
- global $user;
- $user = NULL;
- }
-
- public static function main()
- {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite()
- {
- // I bet there is a better method calling this... :)
- $suite = new phpbb_security_all_tests('phpBB Security Fixes');
-
- $suite->addTestSuite('phpbb_security_extract_current_page_test');
- $suite->addTestSuite('phpbb_security_redirect_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_security_all_tests::main')
-{
- phpbb_security_all_tests::main();
-}
diff --git a/tests/security/base.php b/tests/security/base.php
new file mode 100644
index 0000000000..db9c884cf4
--- /dev/null
+++ b/tests/security/base.php
@@ -0,0 +1,54 @@
+ gzip,deflate
+ [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
+ DOCUMENT_ROOT] => /var/www/
+ [SCRIPT_FILENAME] => /var/www/tests/index.php
+*/
+
+ // Set no user and trick a bit to circumvent errors
+ $user = new user();
+ $user->lang = true;
+ $user->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
+ $user->referer = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : '';
+ $user->forwarded_for = (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? (string) $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
+ $user->host = (!empty($_SERVER['HTTP_HOST'])) ? (string) strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
+ $user->page = session::extract_current_page($phpbb_root_path);
+ }
+
+ protected function tearDown()
+ {
+ global $user;
+ $user = NULL;
+ }
+}
diff --git a/tests/security/extract_current_page.php b/tests/security/extract_current_page.php
index 8c72fe1440..ff0ab4d1bb 100644
--- a/tests/security/extract_current_page.php
+++ b/tests/security/extract_current_page.php
@@ -7,12 +7,12 @@
*
*/
-require_once 'test_framework/framework.php';
+require_once __DIR__ . '/base.php';
-require_once '../phpBB/includes/functions.php';
-require_once '../phpBB/includes/session.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/session.php';
-class phpbb_security_extract_current_page_test extends phpbb_test_case
+class phpbb_security_extract_current_page_test extends phpbb_security_test_base
{
public static function security_variables()
{
diff --git a/tests/security/redirect.php b/tests/security/redirect.php
index 37b0a5bb41..c53414e7df 100644
--- a/tests/security/redirect.php
+++ b/tests/security/redirect.php
@@ -7,12 +7,12 @@
*
*/
-require_once 'test_framework/framework.php';
+require_once __DIR__ . '/base.php';
-require_once '../phpBB/includes/functions.php';
-require_once '../phpBB/includes/session.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/session.php';
-class phpbb_security_redirect_test extends phpbb_test_case
+class phpbb_security_redirect_test extends phpbb_security_test_base
{
public static function provider()
{
@@ -22,13 +22,15 @@ class phpbb_security_redirect_test extends phpbb_test_case
array('bad://localhost/phpBB/index.php', 'Tried to redirect to potentially insecure url.', false),
array('http://www.otherdomain.com/somescript.php', false, 'http://localhost/phpBB'),
array("http://localhost/phpBB/memberlist.php\n\rConnection: close", 'Tried to redirect to potentially insecure url.', false),
- array('javascript:test', false, 'http://localhost/phpBB/../tests/javascript:test'),
+ array('javascript:test', false, 'http://localhost/phpBB/../javascript:test'),
array('http://localhost/phpBB/index.php;url=', 'Tried to redirect to potentially insecure url.', false),
);
}
protected function setUp()
{
+ parent::setUp();
+
$GLOBALS['config'] = array(
'force_server_vars' => '0',
);
diff --git a/tests/template/all_tests.php b/tests/template/all_tests.php
deleted file mode 100644
index ea258c1680..0000000000
--- a/tests/template/all_tests.php
+++ /dev/null
@@ -1,40 +0,0 @@
-addTestSuite('phpbb_template_template_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_template_all_tests::main')
-{
- phpbb_template_all_tests::main();
-}
diff --git a/tests/template/template.php b/tests/template/template.php
index 0c2ca8a032..861adf63e8 100644
--- a/tests/template/template.php
+++ b/tests/template/template.php
@@ -7,9 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-
-require_once '../phpBB/includes/template.php';
+require_once __DIR__ . '/../../phpBB/includes/template.php';
class phpbb_template_template_test extends phpbb_test_case
{
diff --git a/tests/template/templates/_dummy_include.php b/tests/template/templates/_dummy_include.php
deleted file mode 100644
index 1de5dddf59..0000000000
--- a/tests/template/templates/_dummy_include.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
+
diff --git a/tests/test_framework/framework.php b/tests/test_framework/framework.php
deleted file mode 100644
index 3a11cc6df9..0000000000
--- a/tests/test_framework/framework.php
+++ /dev/null
@@ -1,43 +0,0 @@
-= 6.0.0 we do not need some code
-if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
-{
- define('STRIP', false);
-}
-else
-{
- @set_magic_quotes_runtime(0);
- define('STRIP', (get_magic_quotes_gpc()) ? true : false);
-}
-
-require_once $phpbb_root_path . 'includes/constants.php';
-
-// require at least PHPUnit 3.3.0
-require_once 'PHPUnit/Runner/Version.php';
-if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<'))
-{
- trigger_error('PHPUnit >= 3.3.0 required');
-}
-
-if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<'))
-{
- require_once 'PHPUnit/Framework.php';
- require_once 'PHPUnit/Extensions/Database/TestCase.php';
-}
-
-require_once 'test_framework/phpbb_test_case_helpers.php';
-require_once 'test_framework/phpbb_test_case.php';
-require_once 'test_framework/phpbb_database_test_case.php';
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index a64bae8c57..81c4a4f94e 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -96,9 +96,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('test_config.php'))
+ else if (file_exists(__DIR__ . '/../test_config.php'))
{
- include('test_config.php');
+ include(__DIR__ . '/../test_config.php');
return array(
'dbms' => $dbms,
@@ -114,7 +114,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
// Silently use sqlite
return array(
'dbms' => 'sqlite',
- 'dbhost' => 'phpbb_unit_tests.sqlite2', // filename
+ 'dbhost' => __DIR__ . '/../phpbb_unit_tests.sqlite2', // filename
'dbport' => '',
'dbname' => '',
'dbuser' => '',
@@ -325,7 +325,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
}
}
- $sql = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
+ $sql = $this->split_sql_file(file_get_contents(__DIR__ . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
foreach ($sql as $query)
{
@@ -361,7 +361,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
$config = $this->get_database_config();
- require_once '../phpBB/includes/db/' . $config['dbms'] . '.php';
+ require_once __DIR__ . '/../../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']);
diff --git a/tests/text_processing/all_tests.php b/tests/text_processing/all_tests.php
deleted file mode 100644
index 5e759c72ee..0000000000
--- a/tests/text_processing/all_tests.php
+++ /dev/null
@@ -1,41 +0,0 @@
-addTestSuite('phpbb_text_processing_make_clickable_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_text_processing_all_tests::main')
-{
- phpbb_text_processing_all_tests::main();
-}
-
diff --git a/tests/text_processing/make_clickable.php b/tests/text_processing/make_clickable.php
index a667dd705e..75a35daf82 100644
--- a/tests/text_processing/make_clickable.php
+++ b/tests/text_processing/make_clickable.php
@@ -7,10 +7,8 @@
*
*/
-require_once 'test_framework/framework.php';
-
-require_once '../phpBB/includes/functions.php';
-require_once '../phpBB/includes/functions_content.php';
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/functions_content.php';
class phpbb_text_processing_make_clickable_test extends phpbb_test_case
{
diff --git a/tests/utf/all_tests.php b/tests/utf/all_tests.php
deleted file mode 100644
index 0d5d44d695..0000000000
--- a/tests/utf/all_tests.php
+++ /dev/null
@@ -1,43 +0,0 @@
-addTestSuite('phpbb_utf_utf8_wordwrap_test');
- $suite->addTestSuite('phpbb_utf_utf8_clean_string_test');
-
- return $suite;
- }
-}
-
-if (PHPUnit_MAIN_METHOD == 'phpbb_utf_all_tests::main')
-{
- phpbb_utf_all_tests::main();
-}
-
diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php
index 870ad76fc4..148297ad4b 100644
--- a/tests/utf/utf8_clean_string_test.php
+++ b/tests/utf/utf8_clean_string_test.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/utf/utf_tools.php';
+require_once __DIR__ . '/../../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 ef1165a897..fbc947b92a 100644
--- a/tests/utf/utf8_wordwrap_test.php
+++ b/tests/utf/utf8_wordwrap_test.php
@@ -7,8 +7,7 @@
*
*/
-require_once 'test_framework/framework.php';
-require_once '../phpBB/includes/utf/utf_tools.php';
+require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
class phpbb_utf_utf8_wordwrap_test extends phpbb_test_case
{
--
cgit v1.2.1
From cdeffdd59f79310e68d8931e54877359ba58c8e1 Mon Sep 17 00:00:00 2001
From: Andreas Fischer
Date: Wed, 5 Jan 2011 00:40:07 +0100
Subject: [ticket/9589] nginx.conf.sample -> nginx.sample.conf
PHPBB3-9589
---
phpBB/docs/nginx.conf.sample | 70 --------------------------------------------
phpBB/docs/nginx.sample.conf | 70 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 70 deletions(-)
delete mode 100644 phpBB/docs/nginx.conf.sample
create mode 100644 phpBB/docs/nginx.sample.conf
diff --git a/phpBB/docs/nginx.conf.sample b/phpBB/docs/nginx.conf.sample
deleted file mode 100644
index a22a126ff4..0000000000
--- a/phpBB/docs/nginx.conf.sample
+++ /dev/null
@@ -1,70 +0,0 @@
-# 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/docs/nginx.sample.conf b/phpBB/docs/nginx.sample.conf
new file mode 100644
index 0000000000..a22a126ff4
--- /dev/null
+++ b/phpBB/docs/nginx.sample.conf
@@ -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;
+ }
+}
--
cgit v1.2.1
From b720edb05bafb1a5f75da049226c2c8270511f92 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 7 Jan 2011 00:16:28 +0100
Subject: [task/phpunit-xml] Force error reporting level E_ALL | ~E_DEPRECATED.
PHPBB3-9967
---
tests/bootstrap.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 9683ba0d47..99f145e427 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -12,6 +12,8 @@ $phpbb_root_path = 'phpBB/';
$phpEx = 'php';
$table_prefix = '';
+error_reporting(E_ALL & ~E_DEPRECATED);
+
// If we are on PHP >= 6.0.0 we do not need some code
if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
{
--
cgit v1.2.1
From b4f95deefc9d456c5a2d0f6338f6dcecc0829652 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 7 Jan 2011 00:29:44 +0100
Subject: [task/phpunit-xml] Only blacklist the tests directory and do not
whitelist.
It would be ideal if we could whitelist the entire phpBB directory or at least
includes, but at present that still breaks because of classes with the same
name.
PHPBB3-9967
---
phpunit.xml.dist | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e3416c6db3..d1d8adbdd5 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -20,15 +20,6 @@
./tests/
- ./phpBB/
-
- ./phpBB/includes/db/
- ./phpBB/includes/utf/utf_tools.php
- ./phpBB/includes/functions.php
- ./phpBB/includes/functions_content.php
- ./phpBB/includes/session.php
- ./phpBB/includes/template.php
-
--
cgit v1.2.1
From b48b90977382e936a4d98981e55b02c8e574e07b Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 7 Jan 2011 01:07:21 +0100
Subject: [task/phpunit-xml] Manually blacklisting a few PHPUnit classes from
backups.
The blacklisting of these static variables is necessary because code coverage
will otherwise consume too much memory. The problem did not exist in earlier
PHPUnit versions because all classes beginning with PHPUnit are automatically
blacklisted, and code coverage as well as a few other internal classes were
still internal parts of PHPunit. These were now moved to PHP_ namespace,
causing the problem with backupStaticAttributes.
PHPBB3-9967
---
tests/test_framework/phpbb_database_test_case.php | 15 +++++++++++++++
tests/test_framework/phpbb_test_case.php | 15 +++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index 81c4a4f94e..9752ec2fe6 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -13,6 +13,21 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
protected $test_case_helpers;
+ public function __construct($name = NULL, array $data = array(), $dataName = '')
+ {
+ parent::__construct($name, $data, $dataName);
+ $this->backupStaticAttributesBlacklist += array(
+ 'PHP_CodeCoverage' => array('instance'),
+ 'PHP_CodeCoverage_Filter' => array('instance'),
+ 'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
+ 'PHP_Timer' => array('startTimes',),
+ 'PHP_Token_Stream' => array('customTokens'),
+ 'PHP_Token_Stream_CachingFactory' => array('cache'),
+
+ 'phpbb_database_test_case' => array('already_connected'),
+ );
+ }
+
public function get_test_case_helpers()
{
if (!$this->test_case_helpers)
diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php
index fe90d321dc..f189da3671 100644
--- a/tests/test_framework/phpbb_test_case.php
+++ b/tests/test_framework/phpbb_test_case.php
@@ -11,6 +11,21 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase
{
protected $test_case_helpers;
+ public function __construct($name = NULL, array $data = array(), $dataName = '')
+ {
+ parent::__construct($name, $data, $dataName);
+ $this->backupStaticAttributesBlacklist += array(
+ 'PHP_CodeCoverage' => array('instance'),
+ 'PHP_CodeCoverage_Filter' => array('instance'),
+ 'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
+ 'PHP_Timer' => array('startTimes',),
+ 'PHP_Token_Stream' => array('customTokens'),
+ 'PHP_Token_Stream_CachingFactory' => array('cache'),
+
+ 'phpbb_database_test_case' => array('already_connected'),
+ );
+ }
+
public function get_test_case_helpers()
{
if (!$this->test_case_helpers)
--
cgit v1.2.1
From a1731d5e6ec5b7cb6687e6302eb7daaa515f3369 Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 7 Jan 2011 02:25:06 +0100
Subject: [task/phpdoc] Switching from phpDocumentor to phpdoctor.
You can get phpdoctor from https://github.com/peej/phpdoctor
PHPBB3-9943
---
build/build.xml | 8 +-
build/phpdoc-phpbb.ini | 247 ++++++++++++++++++++++++++++---------------------
2 files changed, 150 insertions(+), 105 deletions(-)
diff --git a/build/build.xml b/build/build.xml
index 8d2afcb00c..8d4e333e17 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -65,8 +65,14 @@
+
diff --git a/build/phpdoc-phpbb.ini b/build/phpdoc-phpbb.ini
index 86d33549c0..deaae4c19c 100644
--- a/build/phpdoc-phpbb.ini
+++ b/build/phpdoc-phpbb.ini
@@ -1,106 +1,145 @@
-;; phpDocumentor parse configuration file
-;;
-;; This file is designed to cut down on repetitive typing on the command-line or web interface
-;; You can copy this file to create a number of configuration files that can be used with the
-;; command-line switch -c, as in phpdoc -c default.ini or phpdoc -c myini.ini. The web
-;; interface will automatically generate a list of .ini files that can be used.
-;;
-;; default.ini is used to generate the online manual at http://www.phpdoc.org/docs
-;;
-;; ALL .ini files must be in the user subdirectory of phpDocumentor with an extension of .ini
-;;
-;; Copyright 2002, Greg Beaver
-;;
-;; WARNING: do not change the name of any command-line parameters, phpDocumentor will ignore them
-
-[Parse Data]
-;; title of all the documentation
-;; legal values: any string
-title = phpBB3 Sourcecode Documentation
-
-;; parse files that start with a . like .bash_profile
-;; legal values: true, false
-hidden = false
-
-;; show elements marked @access private in documentation by setting this to on
-;; legal values: on, off
-parseprivate = on
-
-;; parse with javadoc-like description (first sentence is always the short description)
-;; legal values: on, off
-javadocdesc = off
-
-;; add any custom @tags separated by commas here
-;; legal values: any legal tagname separated by commas.
-;customtags = mytag1,mytag2
-
-;; This is only used by the XML:DocBook/peardoc2 converter
-defaultcategoryname = sourcecode
-
-;; what is the main package?
-;; legal values: alphanumeric string plus - and _
-defaultpackagename = phpBB3
-
-;; output any parsing information? set to on for cron jobs
-;; legal values: on
+; Default configuration file for PHPDoctor
+
+; This config file will cause PHPDoctor to generate API documentation of
+; itself.
+
+
+; PHPDoctor settings
+; -----------------------------------------------------------------------------
+
+; Names of files to parse. This can be a single filename, or a comma separated
+; list of filenames. Wildcards are allowed.
+
+files = "*.php"
+
+; Names of files or directories to ignore. This can be a single filename, or a
+; comma separated list of filenames. Wildcards are NOT allowed.
+
+;ignore = "CVS, .svn, .git, _compiled"
+ignore = templates_c/,*HTML/default/*,spec/,*config.php*,*CVS/,test_chora.php,testupdate/,cache/,store/,*proSilver/,develop/,includes/utf/data/,includes/captcha/fonts/,install/update/,install/update.new/,files/,*phpinfo.php*,*update_script.php*,*upgrade.php*,*convert.php*,install/converter/,language/de/,script/,*swatch.php*,*test.php*,*test2.php*,*install.php*,*functions_diff.php*,*acp_update.php*,acm_xcache.php
+
+; The directory to look for files in, if not used the PHPDoctor will look in
+; the current directory (the directory it is run from).
+
+source_path = "../phpBB/"
+
+; If you do not want PHPDoctor to look in each sub directory for files
+; uncomment this line.
+
+;subdirs = off
+
+; Set how loud PHPDoctor is as it runs. Quiet mode suppresses all output other
+; than warnings and errors. Verbose mode outputs additional messages during
+; execution.
+
;quiet = on
+verbose = on
+
+; Select the doclet to use for generating output.
+
+doclet = standard
+;doclet = debug
+
+; The directory to find the doclet in. Doclets control the HTML output of
+; phpDoctor and can be modified to suit your needs. They are expected to be
+; in a directory named after themselves at the location given.
+
+;doclet_path = ./doclets
+
+; Select the formatter to use for generating output.
+
+;formatter = htmlStandardFormatter
+
+; The directory to find the formatter in. Formatters convert textual markup
+; for use by the doclet.
+
+;formatter_path = ./formatters
+
+; The directory to find taglets in. Taglets allow you to make PHPDoctor handle
+; new tags and to alter the behavour of existing tags and their output.
+
+;taglet_path = ./taglets
+
+; If the code you are parsing does not use package tags or not all elements
+; have package tags, use this setting to place unbound elements into a
+; particular package.
+
+default_package = "phpBB"
+
+use_class_path_as_package = off
+
+ignore_package_tags = off
+
+; Specifies the name of a HTML file containing text for the overview
+; documentation to be placed on the overview page. The path is relative to
+; "source_path" unless an absolute path is given.
+
+overview = ../README.md
+
+; Package comments will be looked for in a file named package.html in the same
+; directory as the first source file parsed in that package or in the directory
+; given below. If package comments are placed in the directory given below then
+; they should be named ".html".
+
+package_comment_dir = ./
+
+; Parse out global variables and/or global constants?
+
+;globals = off
+;constants = off
+
+; Generate documentation for all class members
+
+;private = on
+
+; Generate documentation for public and protected class members
+
+;protected = on
+
+; Generate documentation for only public class members
+
+;public = on
+
+; Use the PEAR compatible handling of the docblock first sentence
+
+;pear_compat = on
+
+; Standard doclet settings
+; -----------------------------------------------------------------------------
+
+; The directory to place generated documentation in. If the given path is
+; relative to it will be relative to "source_path".
+
+d = "../build/api/"
+
+; Specifies the title to be placed in the HTML tag.
+
+windowtitle = "phpBB3"
+
+; Specifies the title to be placed near the top of the overview summary file.
+
+doctitle = "phpBB3 Sourcecode Documentation"
+
+; Specifies the header text to be placed at the top of each output file. The
+; header will be placed to the right of the upper navigation bar.
+
+header = "phpBB3"
+
+; Specifies the footer text to be placed at the bottom of each output file. The
+; footer will be placed to the right of the lower navigation bar.
+
+footer = "phpBB3"
+
+; Specifies the text to be placed at the bottom of each output file. The text
+; will be placed at the bottom of the page, below the lower navigation bar.
+
+;bottom = "This document was generated by PHPDoctor: The PHP Documentation Creator "
+
+; Create a class tree?
+
+;tree = off
+
+; Use GeSHi to include formatted source files in the documentation. PHPDoctor will look in the current doclet directory for a /geshi subdirectory. Unpack the GeSHi archive from http://qbnz.com/highlighter to get this directory - it will contain a php script and a subdirectory with formatting files.
+
+include_source = off
-;; parse a PEAR-style repository. Do not turn this on if your project does
-;; not have a parent directory named "pear"
-;; legal values: on/off
-;pear = on
-
-;; where should the documentation be written?
-;; legal values: a legal path
-target = api
-
-;; Which files should be parsed out as special documentation files, such as README,
-;; INSTALL and CHANGELOG? This overrides the default files found in
-;; phpDocumentor.ini (this file is not a user .ini file, but the global file)
-readmeinstallchangelog = README.html, INSTALL.html, CHANGELOG.html, COPYING
-
-;; limit output to the specified packages, even if others are parsed
-;; legal values: package names separated by commas
-;packageoutput = phpBB3,ACP,SEARCH,DBAL,ACM,MCP,UCP,LOGIN,lang_english
-
-;; comma-separated list of files to parse
-;; legal values: paths separated by commas
-;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory
-
-;; comma-separated list of directories to parse
-;; legal values: directory paths separated by commas
-;directory = /path1,/path2,.,..,subdirectory
-;directory = /home/jeichorn/cvs/pear
-directory = ../phpBB/
-
-;; template base directory (the equivalent directory of /phpDocumentor)
-;templatebase = /path/to/my/templates
-
-;; directory to find any example files in through @example and {@example} tags
-;examplesdir = c:\wamp\www\examples
-
-;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore
-;; legal values: any wildcard strings separated by commas
-;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/
-ignore = templates_c/,*HTML/default/*,spec/,*config.php*,*CVS/,test_chora.php,testupdate/,cache/,store/,*proSilver/,develop/,includes/utf/data/,includes/captcha/fonts/,install/update/,install/update.new/,files/,*phpinfo.php*,*update_script.php*,*upgrade.php*,*convert.php*,install/converter/,language/de/,script/,*swatch.php*,*test.php*,*test2.php*,*install.php*,*functions_diff.php*,*acp_update.php*
-
-;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format
-;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,
-;; HTML:frames:earthli,
-;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,
-;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli
-;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS
-;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default
-;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS,CHM:default:default,PDF:default:default
-;output=HTML:frames:DOM/default,XML:DocBook/peardoc2:default,CHM:default:default,HTML:frames:DOM/earthli,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/phphtmllib,HTML:frames:phphtmllib
-;HTML:frames:earthli
-;output=XML:DocBook/peardoc2:default
-
-;output=HTML:frames:DOM/earthli
-;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS,CHM:default:default,PDF:default:default
-;output=HTML:Smarty:PHP
-output=HTML:frames:earthli
-
-;; turn this option on if you want highlighted source code for every file
-;; legal values: on/off
-sourcecode = off
--
cgit v1.2.1
From c3fe0d99f913b105a5ac9d3c74905f756fcb2b4b Mon Sep 17 00:00:00 2001
From: Nils Adermann
Date: Fri, 7 Jan 2011 14:15:22 +0100
Subject: [task/phpdoc] Make phpdoctor output quiet instead of verbose.
PHPBB3-9943
---
build/phpdoc-phpbb.ini | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/build/phpdoc-phpbb.ini b/build/phpdoc-phpbb.ini
index deaae4c19c..f1a7a4bee5 100644
--- a/build/phpdoc-phpbb.ini
+++ b/build/phpdoc-phpbb.ini
@@ -32,8 +32,8 @@ source_path = "../phpBB/"
; than warnings and errors. Verbose mode outputs additional messages during
; execution.
-;quiet = on
-verbose = on
+quiet = on
+;verbose = on
; Select the doclet to use for generating output.
--
cgit v1.2.1
From 9a25e4ad8956f46fa41a6057a8af53f2955fb532 Mon Sep 17 00:00:00 2001
From: rxu
Date: Tue, 4 Jan 2011 11:54:10 +0700
Subject: [ticket/9933] Wrong handling consecutive multiple asterisks in word
censor
Fix consecutive asterisks issue in word censor.
PHPBB3-9933
---
phpBB/includes/acp/acp_words.php | 3 +++
phpBB/includes/cache.php | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php
index 1cb9545967..88c5bbe592 100644
--- a/phpBB/includes/acp/acp_words.php
+++ b/phpBB/includes/acp/acp_words.php
@@ -95,6 +95,9 @@ class acp_words
trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ // Replace multiple consecutive asterisks with single one as those are not needed
+ $word = preg_replace('#\*{2,}#', '*', $word);
+
$sql_ary = array(
'word' => $word,
'replacement' => $replacement
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php
index b50fab4ca2..9b90483b50 100644
--- a/phpBB/includes/cache.php
+++ b/phpBB/includes/cache.php
@@ -90,9 +90,9 @@ class cache extends acm
{
// Unescape the asterisk to simplify further conversions
$row['word'] = str_replace('\*', '*', preg_quote($row['word'], '#'));
-
+
// Replace the asterisk inside the pattern, at the start and at the end of it with regexes
- $row['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}_-]*?'), $row['word']);
+ $row['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}_-]*?'), $row['word']);
// Generate the final substitution
$censors['match'][] = '#(?
Date: Wed, 5 Jan 2011 21:13:33 +0700
Subject: [ticket/9933] Move word censor regex into separate function in
functions.php
PHPBB3-9933
---
phpBB/includes/cache.php | 19 +------------------
phpBB/includes/functions.php | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php
index 9b90483b50..612adcca4f 100644
--- a/phpBB/includes/cache.php
+++ b/phpBB/includes/cache.php
@@ -82,26 +82,9 @@ class cache extends acm
$result = $db->sql_query($sql);
$censors = array();
- $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;
-
while ($row = $db->sql_fetchrow($result))
{
- if ($unicode)
- {
- // Unescape the asterisk to simplify further conversions
- $row['word'] = str_replace('\*', '*', preg_quote($row['word'], '#'));
-
- // Replace the asterisk inside the pattern, at the start and at the end of it with regexes
- $row['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}_-]*?'), $row['word']);
-
- // Generate the final substitution
- $censors['match'][] = '#(?sql_freeresult($result);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index c7f19b709d..69be1627cf 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3428,6 +3428,48 @@ function get_preg_expression($mode)
return '';
}
+/**
+* Generate regexp for naughty words censoring
+* Depends on whether installed PHP version supports unicode properties
+*
+* @param string $word word template to be replaced
+*
+* @return string $preg_expr regex to use with word censor
+*/
+function get_censor_preg_expression($word)
+{
+ static $unicode = null;
+
+ if (empty($word))
+ {
+ return '';
+ }
+
+ // Check whether PHP version supports unicode properties
+ if (is_null($unicode))
+ {
+ $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;
+ }
+
+ if ($unicode)
+ {
+ // Unescape the asterisk to simplify further conversions
+ $word = str_replace('\*', '*', preg_quote($word, '#'));
+
+ // 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);
+
+ // Generate the final substitution
+ $preg_expr = '#(?
Date: Wed, 5 Jan 2011 21:19:50 +0700
Subject: [ticket/9933] Create unit test for word censor regular expression.
PHPBB3-9933
---
tests/regex/censor.php | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 tests/regex/censor.php
diff --git a/tests/regex/censor.php b/tests/regex/censor.php
new file mode 100644
index 0000000000..ae2d86e07e
--- /dev/null
+++ b/tests/regex/censor.php
@@ -0,0 +1,40 @@
+assertRegExp($regex, $subject);
+ }
+}
\ No newline at end of file
--
cgit v1.2.1
From 69616db1ed2ed21db14e2253851a9d76998072d0 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Fri, 7 Jan 2011 22:45:39 +0100
Subject: [ticket/9981] Fix unit test dependencies
PHPBB3-9981
---
tests/request/request_var.php | 1 +
tests/template/template.php | 1 +
2 files changed, 2 insertions(+)
diff --git a/tests/request/request_var.php b/tests/request/request_var.php
index 804e5d6390..0901b43920 100644
--- a/tests/request/request_var.php
+++ b/tests/request/request_var.php
@@ -8,6 +8,7 @@
*/
require_once __DIR__ . '/../../phpBB/includes/functions.php';
+require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
class phpbb_request_request_var_test extends phpbb_test_case
{
diff --git a/tests/template/template.php b/tests/template/template.php
index 861adf63e8..35df17e4c6 100644
--- a/tests/template/template.php
+++ b/tests/template/template.php
@@ -7,6 +7,7 @@
*
*/
+require_once __DIR__ . '/../../phpBB/includes/functions.php';
require_once __DIR__ . '/../../phpBB/includes/template.php';
class phpbb_template_template_test extends phpbb_test_case
--
cgit v1.2.1
From 6a7c85382828dc95b5190ab6dde5ae25149e6025 Mon Sep 17 00:00:00 2001
From: Raimon
Date: Fri, 7 Jan 2011 23:47:17 +0100
Subject: [ticket/9980] URLs to javascript should be T_SUPER_TEMPLATE_PATH
instead of T_TEMPLATE_PATH
PHPBB3-9980
---
phpBB/styles/prosilver/template/memberlist_search.html | 2 +-
phpBB/styles/prosilver/template/overall_header.html | 4 ++--
phpBB/styles/prosilver/template/posting_buttons.html | 2 +-
phpBB/styles/prosilver/template/posting_smilies.html | 2 +-
phpBB/styles/prosilver/template/simple_header.html | 4 ++--
phpBB/styles/subsilver2/template/posting_buttons.html | 2 +-
phpBB/styles/subsilver2/template/posting_smilies.html | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html
index b95185a6f2..9df648f644 100644
--- a/phpBB/styles/prosilver/template/memberlist_search.html
+++ b/phpBB/styles/prosilver/template/memberlist_search.html
@@ -37,7 +37,7 @@ function insert_single(user)
}
// ]]>
-
+
{L_FIND_USERNAME}
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 44857dbc41..e607b6f489 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -85,8 +85,8 @@
// ]]>
-
-
+
+
diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html
index 5d21229611..19d55d1a4a 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -38,7 +38,7 @@
// ]]>
-
+
diff --git a/phpBB/styles/prosilver/template/posting_smilies.html b/phpBB/styles/prosilver/template/posting_smilies.html
index fdd0d7ada1..86ac24aa53 100644
--- a/phpBB/styles/prosilver/template/posting_smilies.html
+++ b/phpBB/styles/prosilver/template/posting_smilies.html
@@ -6,7 +6,7 @@
var text_name = 'message';
// ]]>
-
+
{L_SMILIES}
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index 0e2409586c..ef9b0a5573 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -47,8 +47,8 @@
// ]]>
-
-
+
+
diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html
index 621fa87fd4..92b4bd3e39 100644
--- a/phpBB/styles/subsilver2/template/posting_buttons.html
+++ b/phpBB/styles/subsilver2/template/posting_buttons.html
@@ -33,7 +33,7 @@
// ]]>
-
+
diff --git a/phpBB/styles/subsilver2/template/posting_smilies.html b/phpBB/styles/subsilver2/template/posting_smilies.html
index 2586530e55..fcab578bd9 100644
--- a/phpBB/styles/subsilver2/template/posting_smilies.html
+++ b/phpBB/styles/subsilver2/template/posting_smilies.html
@@ -6,7 +6,7 @@
var text_name = 'message';
// ]]>
-
+
--
cgit v1.2.1
From 01fe91c5c4e897801f5c179cd4060e686762f105 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Mon, 10 Jan 2011 00:18:37 +0100
Subject: [ticket/9987] Rename test files to include a _test suffix
PHPBB3-9987
---
phpunit.xml.dist | 2 +-
tests/dbal/select.php | 320 ------------
tests/dbal/select_test.php | 320 ++++++++++++
tests/dbal/write.php | 171 -------
tests/dbal/write_test.php | 171 +++++++
tests/network/checkdnsrr.php | 62 ---
tests/network/checkdnsrr_test.php | 62 +++
tests/random/gen_rand_string.php | 62 ---
tests/random/gen_rand_string_test.php | 62 +++
tests/regex/censor.php | 40 --
tests/regex/censor_test.php | 40 ++
tests/regex/email.php | 118 -----
tests/regex/email_test.php | 118 +++++
tests/regex/ipv4.php | 71 ---
tests/regex/ipv4_test.php | 71 +++
tests/regex/ipv6.php | 142 ------
tests/regex/ipv6_test.php | 142 ++++++
tests/regex/url.php | 33 --
tests/regex/url_test.php | 33 ++
tests/request/request_var.php | 180 -------
tests/request/request_var_test.php | 180 +++++++
tests/security/extract_current_page.php | 53 --
tests/security/extract_current_page_test.php | 53 ++
tests/security/redirect.php | 60 ---
tests/security/redirect_test.php | 60 +++
tests/template/template.php | 689 --------------------------
tests/template/template_test.php | 689 ++++++++++++++++++++++++++
tests/text_processing/make_clickable.php | 104 ----
tests/text_processing/make_clickable_test.php | 104 ++++
29 files changed, 2106 insertions(+), 2106 deletions(-)
delete mode 100644 tests/dbal/select.php
create mode 100644 tests/dbal/select_test.php
delete mode 100644 tests/dbal/write.php
create mode 100644 tests/dbal/write_test.php
delete mode 100644 tests/network/checkdnsrr.php
create mode 100644 tests/network/checkdnsrr_test.php
delete mode 100644 tests/random/gen_rand_string.php
create mode 100644 tests/random/gen_rand_string_test.php
delete mode 100644 tests/regex/censor.php
create mode 100644 tests/regex/censor_test.php
delete mode 100644 tests/regex/email.php
create mode 100644 tests/regex/email_test.php
delete mode 100644 tests/regex/ipv4.php
create mode 100644 tests/regex/ipv4_test.php
delete mode 100644 tests/regex/ipv6.php
create mode 100644 tests/regex/ipv6_test.php
delete mode 100644 tests/regex/url.php
create mode 100644 tests/regex/url_test.php
delete mode 100644 tests/request/request_var.php
create mode 100644 tests/request/request_var_test.php
delete mode 100644 tests/security/extract_current_page.php
create mode 100644 tests/security/extract_current_page_test.php
delete mode 100644 tests/security/redirect.php
create mode 100644 tests/security/redirect_test.php
delete mode 100644 tests/template/template.php
create mode 100644 tests/template/template_test.php
delete mode 100644 tests/text_processing/make_clickable.php
create mode 100644 tests/text_processing/make_clickable_test.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index d1d8adbdd5..78c7fdd93a 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -13,7 +13,7 @@
>
- ./tests/
+ ./tests/
diff --git a/tests/dbal/select.php b/tests/dbal/select.php
deleted file mode 100644
index 987de5cbff..0000000000
--- a/tests/dbal/select.php
+++ /dev/null
@@ -1,320 +0,0 @@
-createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml');
- }
-
- public static function return_on_error_select_data()
- {
- return array(
- array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))),
- array('phpbb_users', 'username_clean syntax_error', false),
- );
- }
-
- /**
- * @dataProvider return_on_error_select_data
- */
- public function test_return_on_error_select($table, $where, $expected)
- {
- $db = $this->new_dbal();
-
- $db->sql_return_on_error(true);
-
- $result = $db->sql_query('SELECT username_clean
- FROM ' . $table . '
- WHERE ' . $where . '
- ORDER BY user_id ASC');
-
- $db->sql_return_on_error(false);
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
- }
-
- public static function fetchrow_data()
- {
- return array(
- array('', array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array('user_id = 2', array(array('username_clean' => 'foobar'))),
- array("username_clean = 'bertie'", array(array('username_clean' => 'bertie'))),
- array("username_clean = 'phpBB'", array()),
- );
- }
-
- /**
- * @dataProvider fetchrow_data
- */
- public function test_fetchrow($where, $expected)
- {
- $db = $this->new_dbal();
-
- $result = $db->sql_query('SELECT username_clean
- FROM phpbb_users
- ' . (($where) ? ' WHERE ' . $where : '') . '
- ORDER BY user_id ASC');
-
- $ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $ary[] = $row;
- }
- $db->sql_freeresult($result);
-
- $this->assertEquals($expected, $ary);
- }
-
- /**
- * @dataProvider fetchrow_data
- */
- public function test_fetchrowset($where, $expected)
- {
- $db = $this->new_dbal();
-
- $result = $db->sql_query('SELECT username_clean
- FROM phpbb_users
- ' . (($where) ? ' WHERE ' . $where : '') . '
- ORDER BY user_id ASC');
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-
- public static function fetchfield_data()
- {
- return array(
- array('', array('barfoo', 'foobar', 'bertie')),
- array('user_id = 2', array('foobar')),
- );
- }
-
- /**
- * @dataProvider fetchfield_data
- */
- public function test_fetchfield($where, $expected)
- {
- $db = $this->new_dbal();
-
- $result = $db->sql_query('SELECT username_clean
- FROM phpbb_users
- ' . (($where) ? ' WHERE ' . $where : '') . '
- ORDER BY user_id ASC');
-
- $ary = array();
- while ($row = $db->sql_fetchfield('username_clean'))
- {
- $ary[] = $row;
- }
- $db->sql_freeresult($result);
-
- $this->assertEquals($expected, $ary);
- }
-
- public static function query_limit_data()
- {
- return array(
- array(0, 0, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array(0, 1, array(array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array(1, 0, array(array('username_clean' => 'barfoo'))),
- array(1, 2, array(array('username_clean' => 'bertie'))),
- array(2, 0, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array(2, 2, array(array('username_clean' => 'bertie'))),
- array(2, 5, array()),
- array(10, 1, array(array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array(10, 5, array()),
- );
- }
-
- /**
- * @dataProvider query_limit_data
- */
- public function test_query_limit($total, $offset, $expected)
- {
- $db = $this->new_dbal();
-
- $result = $db->sql_query_limit('SELECT username_clean
- FROM phpbb_users
- ORDER BY user_id ASC', $total, $offset);
-
- $ary = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $ary[] = $row;
- }
- $db->sql_freeresult($result);
-
- $this->assertEquals($expected, $ary);
- }
-
- public static function like_expression_data()
- {
- // * = any_char; # = one_char
- return array(
- array('barfoo', array(array('username_clean' => 'barfoo'))),
- array('bar', array()),
- array('bar*', array(array('username_clean' => 'barfoo'))),
- array('*bar*', array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('b*r', array()),
- array('b*e', array(array('username_clean' => 'bertie'))),
- array('#b*e', array()),
- array('b####e', array(array('username_clean' => 'bertie'))),
- );
- }
-
- /**
- * @dataProvider like_expression_data
- */
- public function test_like_expression($like_expression, $expected)
- {
- $db = $this->new_dbal();
-
- $like_expression = str_replace('*', $db->any_char, $like_expression);
- $like_expression = str_replace('#', $db->one_char, $like_expression);
- $where = ($like_expression) ? 'username_clean ' . $db->sql_like_expression($like_expression) : '';
-
- $result = $db->sql_query('SELECT username_clean
- FROM phpbb_users
- ' . (($where) ? ' WHERE ' . $where : '') . '
- ORDER BY user_id ASC');
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-
- public static function in_set_data()
- {
- return array(
- array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))),
- array('user_id', 3, false, true, array(array('username_clean' => 'bertie'))),
- array('user_id', 3, true, false, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('user_id', 3, true, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('username_clean', 'bertie', false, false, array(array('username_clean' => 'bertie'))),
- array('username_clean', 'bertie', false, true, array(array('username_clean' => 'bertie'))),
- array('username_clean', 'bertie', true, false, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('username_clean', 'bertie', true, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('user_id', array(3), false, false, array(array('username_clean' => 'bertie'))),
- array('user_id', array(3), false, true, array(array('username_clean' => 'bertie'))),
- array('user_id', array(3), true, false, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('user_id', array(3), true, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'))),
- array('user_id', array(1, 3), false, false, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'bertie'))),
- array('user_id', array(1, 3), false, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'bertie'))),
- array('user_id', array(1, 3), true, false, array(array('username_clean' => 'foobar'))),
- array('user_id', array(1, 3), true, true, array(array('username_clean' => 'foobar'))),
- array('username_clean', '', false, false, array()),
- array('username_clean', '', false, true, array()),
- array('username_clean', '', true, false, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array('username_clean', '', true, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
- array('user_id', array(), false, true, array()),
- array('user_id', array(), true, true, array(array('username_clean' => 'barfoo'),
- array('username_clean' => 'foobar'),
- array('username_clean' => 'bertie'))),
-
- // These here would throw errors and therefor $result should be false.
- // Removing for now because SQLite accepts empty IN() syntax
- /*array('user_id', array(), false, false, false, true),
- array('user_id', array(), true, false, false, true),*/
- );
- }
-
- /**
- * @dataProvider in_set_data
- */
- public function test_in_set($field, $array, $negate, $allow_empty_set, $expected, $catch_error = false)
- {
- $db = $this->new_dbal();
-
- if ($catch_error)
- {
- $db->sql_return_on_error(true);
- }
-
- $result = $db->sql_query('SELECT username_clean
- FROM phpbb_users
- WHERE ' . $db->sql_in_set($field, $array, $negate, $allow_empty_set) . '
- ORDER BY user_id ASC');
-
- if ($catch_error)
- {
- $db->sql_return_on_error(false);
- }
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-
- public static function build_array_data()
- {
- return array(
- array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))),
- array(array('username_clean' => 'barfoo', 'user_id' => 1), array(array('username_clean' => 'barfoo'))),
- array(array('username_clean' => 'barfoo', 'user_id' => 2), array()),
-
- // These here would throw errors and therefor $result should be false.
- array(array(), false, true),
- array('no_array', false, true),
- array(0, false, true),
- );
- }
-
- /**
- * @dataProvider build_array_data
- */
- public function test_build_array($assoc_ary, $expected, $catch_error = false)
- {
- $db = $this->new_dbal();
-
- if ($catch_error)
- {
- $db->sql_return_on_error(true);
- }
-
- $sql = 'SELECT username_clean
- FROM phpbb_users
- WHERE ' . $db->sql_build_array('SELECT', $assoc_ary) . '
- ORDER BY user_id ASC';
- $result = $db->sql_query($sql);
-
- if ($catch_error)
- {
- $db->sql_return_on_error(false);
- }
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-}
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
new file mode 100644
index 0000000000..987de5cbff
--- /dev/null
+++ b/tests/dbal/select_test.php
@@ -0,0 +1,320 @@
+createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml');
+ }
+
+ public static function return_on_error_select_data()
+ {
+ return array(
+ array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))),
+ array('phpbb_users', 'username_clean syntax_error', false),
+ );
+ }
+
+ /**
+ * @dataProvider return_on_error_select_data
+ */
+ public function test_return_on_error_select($table, $where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $db->sql_return_on_error(true);
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM ' . $table . '
+ WHERE ' . $where . '
+ ORDER BY user_id ASC');
+
+ $db->sql_return_on_error(false);
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+ }
+
+ public static function fetchrow_data()
+ {
+ return array(
+ array('', array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array('user_id = 2', array(array('username_clean' => 'foobar'))),
+ array("username_clean = 'bertie'", array(array('username_clean' => 'bertie'))),
+ array("username_clean = 'phpBB'", array()),
+ );
+ }
+
+ /**
+ * @dataProvider fetchrow_data
+ */
+ public function test_fetchrow($where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ ' . (($where) ? ' WHERE ' . $where : '') . '
+ ORDER BY user_id ASC');
+
+ $ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ary[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $this->assertEquals($expected, $ary);
+ }
+
+ /**
+ * @dataProvider fetchrow_data
+ */
+ public function test_fetchrowset($where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ ' . (($where) ? ' WHERE ' . $where : '') . '
+ ORDER BY user_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+
+ public static function fetchfield_data()
+ {
+ return array(
+ array('', array('barfoo', 'foobar', 'bertie')),
+ array('user_id = 2', array('foobar')),
+ );
+ }
+
+ /**
+ * @dataProvider fetchfield_data
+ */
+ public function test_fetchfield($where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ ' . (($where) ? ' WHERE ' . $where : '') . '
+ ORDER BY user_id ASC');
+
+ $ary = array();
+ while ($row = $db->sql_fetchfield('username_clean'))
+ {
+ $ary[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $this->assertEquals($expected, $ary);
+ }
+
+ public static function query_limit_data()
+ {
+ return array(
+ array(0, 0, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array(0, 1, array(array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array(1, 0, array(array('username_clean' => 'barfoo'))),
+ array(1, 2, array(array('username_clean' => 'bertie'))),
+ array(2, 0, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array(2, 2, array(array('username_clean' => 'bertie'))),
+ array(2, 5, array()),
+ array(10, 1, array(array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array(10, 5, array()),
+ );
+ }
+
+ /**
+ * @dataProvider query_limit_data
+ */
+ public function test_query_limit($total, $offset, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $result = $db->sql_query_limit('SELECT username_clean
+ FROM phpbb_users
+ ORDER BY user_id ASC', $total, $offset);
+
+ $ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ary[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $this->assertEquals($expected, $ary);
+ }
+
+ public static function like_expression_data()
+ {
+ // * = any_char; # = one_char
+ return array(
+ array('barfoo', array(array('username_clean' => 'barfoo'))),
+ array('bar', array()),
+ array('bar*', array(array('username_clean' => 'barfoo'))),
+ array('*bar*', array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('b*r', array()),
+ array('b*e', array(array('username_clean' => 'bertie'))),
+ array('#b*e', array()),
+ array('b####e', array(array('username_clean' => 'bertie'))),
+ );
+ }
+
+ /**
+ * @dataProvider like_expression_data
+ */
+ public function test_like_expression($like_expression, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $like_expression = str_replace('*', $db->any_char, $like_expression);
+ $like_expression = str_replace('#', $db->one_char, $like_expression);
+ $where = ($like_expression) ? 'username_clean ' . $db->sql_like_expression($like_expression) : '';
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ ' . (($where) ? ' WHERE ' . $where : '') . '
+ ORDER BY user_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+
+ public static function in_set_data()
+ {
+ return array(
+ array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))),
+ array('user_id', 3, false, true, array(array('username_clean' => 'bertie'))),
+ array('user_id', 3, true, false, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('user_id', 3, true, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('username_clean', 'bertie', false, false, array(array('username_clean' => 'bertie'))),
+ array('username_clean', 'bertie', false, true, array(array('username_clean' => 'bertie'))),
+ array('username_clean', 'bertie', true, false, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('username_clean', 'bertie', true, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('user_id', array(3), false, false, array(array('username_clean' => 'bertie'))),
+ array('user_id', array(3), false, true, array(array('username_clean' => 'bertie'))),
+ array('user_id', array(3), true, false, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('user_id', array(3), true, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'))),
+ array('user_id', array(1, 3), false, false, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'bertie'))),
+ array('user_id', array(1, 3), false, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'bertie'))),
+ array('user_id', array(1, 3), true, false, array(array('username_clean' => 'foobar'))),
+ array('user_id', array(1, 3), true, true, array(array('username_clean' => 'foobar'))),
+ array('username_clean', '', false, false, array()),
+ array('username_clean', '', false, true, array()),
+ array('username_clean', '', true, false, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array('username_clean', '', true, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+ array('user_id', array(), false, true, array()),
+ array('user_id', array(), true, true, array(array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))),
+
+ // These here would throw errors and therefor $result should be false.
+ // Removing for now because SQLite accepts empty IN() syntax
+ /*array('user_id', array(), false, false, false, true),
+ array('user_id', array(), true, false, false, true),*/
+ );
+ }
+
+ /**
+ * @dataProvider in_set_data
+ */
+ public function test_in_set($field, $array, $negate, $allow_empty_set, $expected, $catch_error = false)
+ {
+ $db = $this->new_dbal();
+
+ if ($catch_error)
+ {
+ $db->sql_return_on_error(true);
+ }
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ WHERE ' . $db->sql_in_set($field, $array, $negate, $allow_empty_set) . '
+ ORDER BY user_id ASC');
+
+ if ($catch_error)
+ {
+ $db->sql_return_on_error(false);
+ }
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+
+ public static function build_array_data()
+ {
+ return array(
+ array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))),
+ array(array('username_clean' => 'barfoo', 'user_id' => 1), array(array('username_clean' => 'barfoo'))),
+ array(array('username_clean' => 'barfoo', 'user_id' => 2), array()),
+
+ // These here would throw errors and therefor $result should be false.
+ array(array(), false, true),
+ array('no_array', false, true),
+ array(0, false, true),
+ );
+ }
+
+ /**
+ * @dataProvider build_array_data
+ */
+ public function test_build_array($assoc_ary, $expected, $catch_error = false)
+ {
+ $db = $this->new_dbal();
+
+ if ($catch_error)
+ {
+ $db->sql_return_on_error(true);
+ }
+
+ $sql = 'SELECT username_clean
+ FROM phpbb_users
+ WHERE ' . $db->sql_build_array('SELECT', $assoc_ary) . '
+ ORDER BY user_id ASC';
+ $result = $db->sql_query($sql);
+
+ if ($catch_error)
+ {
+ $db->sql_return_on_error(false);
+ }
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+}
diff --git a/tests/dbal/write.php b/tests/dbal/write.php
deleted file mode 100644
index a24b6efcc4..0000000000
--- a/tests/dbal/write.php
+++ /dev/null
@@ -1,171 +0,0 @@
-createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml');
- }
-
- public static function build_array_insert_data()
- {
- return array(
- array(array(
- 'config_name' => 'test_version',
- 'config_value' => '0.0.0',
- 'is_dynamic' => 1,
- )),
- array(array(
- 'config_name' => 'second config',
- 'config_value' => '10',
- 'is_dynamic' => 0,
- )),
- );
- }
-
- /**
- * @dataProvider build_array_insert_data
- */
- public function test_build_array_insert($sql_ary)
- {
- $db = $this->new_dbal();
-
- $sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary);
- $result = $db->sql_query($sql);
-
- $sql = "SELECT *
- FROM phpbb_config
- WHERE config_name = '" . $sql_ary['config_name'] . "'";
- $result = $db->sql_query_limit($sql, 1);
-
- $this->assertEquals($sql_ary, $db->sql_fetchrow($result));
-
- $db->sql_freeresult($result);
- }
-
- public function test_delete()
- {
- $db = $this->new_dbal();
-
- $sql = "DELETE FROM phpbb_config
- WHERE config_name = 'config1'";
- $result = $db->sql_query($sql);
-
- $sql = 'SELECT *
- FROM phpbb_config';
- $result = $db->sql_query($sql);
- $rows = $db->sql_fetchrowset($result);
-
- $this->assertEquals(1, sizeof($rows));
- $this->assertEquals('config2', $rows[0]['config_name']);
-
- $db->sql_freeresult($result);
- }
-
- public function test_multiple_insert()
- {
- $db = $this->new_dbal();
-
- // empty the table
- $sql = 'DELETE FROM phpbb_config';
- $db->sql_query($sql);
-
- $batch_ary = array(
- array(
- 'config_name' => 'batch one',
- 'config_value' => 'b1',
- 'is_dynamic' => 0,
- ),
- array(
- 'config_name' => 'batch two',
- 'config_value' => 'b2',
- 'is_dynamic' => 1,
- ),
- );
-
- $result = $db->sql_multi_insert('phpbb_config', $batch_ary);
-
- $sql = 'SELECT *
- FROM phpbb_config
- ORDER BY config_name ASC';
- $result = $db->sql_query($sql);
-
- $this->assertEquals($batch_ary, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-
- public static function update_data()
- {
- return array(
- array(
- array(
- 'config_value' => '23',
- 'is_dynamic' => 0,
- ),
- " WHERE config_name = 'config1'",
- array(
- array(
- 'config_name' => 'config1',
- 'config_value' => '23',
- 'is_dynamic' => 0,
- ),
- array(
- 'config_name' => 'config2',
- 'config_value' => 'bar',
- 'is_dynamic' => 1,
- ),
- ),
- ),
- array(
- array(
- 'config_value' => '0',
- 'is_dynamic' => 1,
- ),
- '',
- array(
- array(
- 'config_name' => 'config1',
- 'config_value' => '0',
- 'is_dynamic' => 1,
- ),
- array(
- 'config_name' => 'config2',
- 'config_value' => '0',
- 'is_dynamic' => 1,
- ),
- ),
- ),
- );
- }
-
- /**
- * @dataProvider update_data
- */
- public function test_update($sql_ary, $where, $expected)
- {
- $db = $this->new_dbal();
-
- $sql = 'UPDATE phpbb_config
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where;
- $result = $db->sql_query($sql);
-
- $sql = 'SELECT *
- FROM phpbb_config
- ORDER BY config_name ASC';
- $result = $db->sql_query($sql);
-
- $this->assertEquals($expected, $db->sql_fetchrowset($result));
-
- $db->sql_freeresult($result);
- }
-}
diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php
new file mode 100644
index 0000000000..a24b6efcc4
--- /dev/null
+++ b/tests/dbal/write_test.php
@@ -0,0 +1,171 @@
+createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml');
+ }
+
+ public static function build_array_insert_data()
+ {
+ return array(
+ array(array(
+ 'config_name' => 'test_version',
+ 'config_value' => '0.0.0',
+ 'is_dynamic' => 1,
+ )),
+ array(array(
+ 'config_name' => 'second config',
+ 'config_value' => '10',
+ 'is_dynamic' => 0,
+ )),
+ );
+ }
+
+ /**
+ * @dataProvider build_array_insert_data
+ */
+ public function test_build_array_insert($sql_ary)
+ {
+ $db = $this->new_dbal();
+
+ $sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary);
+ $result = $db->sql_query($sql);
+
+ $sql = "SELECT *
+ FROM phpbb_config
+ WHERE config_name = '" . $sql_ary['config_name'] . "'";
+ $result = $db->sql_query_limit($sql, 1);
+
+ $this->assertEquals($sql_ary, $db->sql_fetchrow($result));
+
+ $db->sql_freeresult($result);
+ }
+
+ public function test_delete()
+ {
+ $db = $this->new_dbal();
+
+ $sql = "DELETE FROM phpbb_config
+ WHERE config_name = 'config1'";
+ $result = $db->sql_query($sql);
+
+ $sql = 'SELECT *
+ FROM phpbb_config';
+ $result = $db->sql_query($sql);
+ $rows = $db->sql_fetchrowset($result);
+
+ $this->assertEquals(1, sizeof($rows));
+ $this->assertEquals('config2', $rows[0]['config_name']);
+
+ $db->sql_freeresult($result);
+ }
+
+ public function test_multiple_insert()
+ {
+ $db = $this->new_dbal();
+
+ // empty the table
+ $sql = 'DELETE FROM phpbb_config';
+ $db->sql_query($sql);
+
+ $batch_ary = array(
+ array(
+ 'config_name' => 'batch one',
+ 'config_value' => 'b1',
+ 'is_dynamic' => 0,
+ ),
+ array(
+ 'config_name' => 'batch two',
+ 'config_value' => 'b2',
+ 'is_dynamic' => 1,
+ ),
+ );
+
+ $result = $db->sql_multi_insert('phpbb_config', $batch_ary);
+
+ $sql = 'SELECT *
+ FROM phpbb_config
+ ORDER BY config_name ASC';
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($batch_ary, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+
+ public static function update_data()
+ {
+ return array(
+ array(
+ array(
+ 'config_value' => '23',
+ 'is_dynamic' => 0,
+ ),
+ " WHERE config_name = 'config1'",
+ array(
+ array(
+ 'config_name' => 'config1',
+ 'config_value' => '23',
+ 'is_dynamic' => 0,
+ ),
+ array(
+ 'config_name' => 'config2',
+ 'config_value' => 'bar',
+ 'is_dynamic' => 1,
+ ),
+ ),
+ ),
+ array(
+ array(
+ 'config_value' => '0',
+ 'is_dynamic' => 1,
+ ),
+ '',
+ array(
+ array(
+ 'config_name' => 'config1',
+ 'config_value' => '0',
+ 'is_dynamic' => 1,
+ ),
+ array(
+ 'config_name' => 'config2',
+ 'config_value' => '0',
+ 'is_dynamic' => 1,
+ ),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider update_data
+ */
+ public function test_update($sql_ary, $where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $sql = 'UPDATE phpbb_config
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where;
+ $result = $db->sql_query($sql);
+
+ $sql = 'SELECT *
+ FROM phpbb_config
+ ORDER BY config_name ASC';
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+}
diff --git a/tests/network/checkdnsrr.php b/tests/network/checkdnsrr.php
deleted file mode 100644
index 427132e508..0000000000
--- a/tests/network/checkdnsrr.php
+++ /dev/null
@@ -1,62 +0,0 @@
-assertEquals($expected, phpbb_checkdnsrr($host, $type));
- }
-}
diff --git a/tests/network/checkdnsrr_test.php b/tests/network/checkdnsrr_test.php
new file mode 100644
index 0000000000..427132e508
--- /dev/null
+++ b/tests/network/checkdnsrr_test.php
@@ -0,0 +1,62 @@
+assertEquals($expected, phpbb_checkdnsrr($host, $type));
+ }
+}
diff --git a/tests/random/gen_rand_string.php b/tests/random/gen_rand_string.php
deleted file mode 100644
index fa519f134c..0000000000
--- a/tests/random/gen_rand_string.php
+++ /dev/null
@@ -1,62 +0,0 @@
-assertTrue($random_string_length >= self::MIN_STRING_LENGTH);
- $this->assertTrue($random_string_length <= $num_chars);
- $this->assertRegExp('#^[A-Z0-9]+$#', $random_string);
- }
- }
- }
-
- public function test_gen_rand_string_friendly()
- {
- for ($tests = 0; $tests <= self::TEST_COUNT; ++$tests)
- {
- for ($num_chars = self::MIN_STRING_LENGTH; $num_chars <= self::MAX_STRING_LENGTH; ++$num_chars)
- {
- $random_string = gen_rand_string_friendly($num_chars);
- $random_string_length = strlen($random_string);
-
- $this->assertTrue($random_string_length >= self::MIN_STRING_LENGTH);
- $this->assertTrue($random_string_length <= $num_chars);
- $this->assertRegExp('#^[A-NP-Z1-9]+$#', $random_string);
- }
- }
- }
-}
diff --git a/tests/random/gen_rand_string_test.php b/tests/random/gen_rand_string_test.php
new file mode 100644
index 0000000000..fa519f134c
--- /dev/null
+++ b/tests/random/gen_rand_string_test.php
@@ -0,0 +1,62 @@
+assertTrue($random_string_length >= self::MIN_STRING_LENGTH);
+ $this->assertTrue($random_string_length <= $num_chars);
+ $this->assertRegExp('#^[A-Z0-9]+$#', $random_string);
+ }
+ }
+ }
+
+ public function test_gen_rand_string_friendly()
+ {
+ for ($tests = 0; $tests <= self::TEST_COUNT; ++$tests)
+ {
+ for ($num_chars = self::MIN_STRING_LENGTH; $num_chars <= self::MAX_STRING_LENGTH; ++$num_chars)
+ {
+ $random_string = gen_rand_string_friendly($num_chars);
+ $random_string_length = strlen($random_string);
+
+ $this->assertTrue($random_string_length >= self::MIN_STRING_LENGTH);
+ $this->assertTrue($random_string_length <= $num_chars);
+ $this->assertRegExp('#^[A-NP-Z1-9]+$#', $random_string);
+ }
+ }
+ }
+}
diff --git a/tests/regex/censor.php b/tests/regex/censor.php
deleted file mode 100644
index ae2d86e07e..0000000000
--- a/tests/regex/censor.php
+++ /dev/null
@@ -1,40 +0,0 @@
-assertRegExp($regex, $subject);
- }
-}
\ No newline at end of file
diff --git a/tests/regex/censor_test.php b/tests/regex/censor_test.php
new file mode 100644
index 0000000000..ae2d86e07e
--- /dev/null
+++ b/tests/regex/censor_test.php
@@ -0,0 +1,40 @@
+assertRegExp($regex, $subject);
+ }
+}
\ No newline at end of file
diff --git a/tests/regex/email.php b/tests/regex/email.php
deleted file mode 100644
index 5d6e207cbb..0000000000
--- a/tests/regex/email.php
+++ /dev/null
@@ -1,118 +0,0 @@
-regex = '#^' . get_preg_expression('email') . '$#i';
- }
-
- public function positive_match_data()
- {
- return array(
- array('nobody@phpbb.com'),
- array('Nobody@sub.phpbb.com'),
- array('alice.bob@foo.phpbb.com'),
- array('alice-foo@bar.phpbb.com'),
- array('alice_foo@bar.phpbb.com'),
- array('alice+tag@foo.phpbb.com'),
- array('alice&tag@foo.phpbb.com'),
-
- //array('"John Doe"@example.com'),
- //array('Alice@[192.168.2.1]'), // IPv4
- //array('Bob@[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]'), // IPv6
-
- // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
- array('l3tt3rsAndNumb3rs@domain.com'),
- array('has-dash@domain.com'),
- array('hasApostrophe.o\'leary@domain.org'),
- array('uncommonTLD@domain.museum'),
- array('uncommonTLD@domain.travel'),
- array('uncommonTLD@domain.mobi'),
- array('countryCodeTLD@domain.uk'),
- array('countryCodeTLD@domain.rw'),
- array('numbersInDomain@911.com'),
- array('underscore_inLocal@domain.net'),
- array('IPInsteadOfDomain@127.0.0.1'),
- array('IPAndPort@127.0.0.1:25'),
- array('subdomain@sub.domain.com'),
- array('local@dash-inDomain.com'),
- array('dot.inLocal@foo.com'),
- array('a@singleLetterLocal.org'),
- array('singleLetterDomain@x.org'),
- array('&*=?^+{}\'~@validCharsInLocal.net'),
- array('foor@bar.newTLD'),
- );
- }
-
- public function negative_match_data()
- {
- return array(
- array('foo.example.com'), // @ is missing
- array('.foo.example.com'), // . as first character
- array('Foo.@example.com'), // . is last in local part
- array('foo..123@example.com'), // . doubled
- array('a@b@c@example.com'), // @ doubled
-
- array('()[]\;:,<>@example.com'), // invalid characters
- array('abc(def@example.com'), // invalid character (
- array('abc)def@example.com'), // invalid character )
- array('abc[def@example.com'), // invalid character [
- array('abc]def@example.com'), // invalid character ]
- array('abc\def@example.com'), // invalid character \
- array('abc;def@example.com'), // invalid character ;
- array('abc:def@example.com'), // invalid character :
- array('abc,def@example.com'), // invalid character ,
- array('abcdef@example.com'), // invalid character >
-
- // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
- array('missingDomain@.com'),
- array('@missingLocal.org'),
- array('missingatSign.net'),
- array('missingDot@com'),
- array('two@@signs.com'),
- array('colonButNoPort@127.0.0.1:'),
- array(''),
- array('someone-else@127.0.0.1.26'),
- array('.localStartsWithDot@domain.com'),
- array('localEndsWithDot.@domain.com'),
- array('two..consecutiveDots@domain.com'),
- array('domainStartsWithDash@-domain.com'),
- array('domainEndsWithDash@domain-.com'),
- array('numbersInTLD@domain.c0m'),
- array('missingTLD@domain.'),
- array('! "#$%(),/;<>[]`|@invalidCharsInLocal.org'),
- array('invalidCharsInDomain@! "#$%(),/;<>_[]`|.org'),
- array('local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org'),
- );
- }
-
- /**
- * @dataProvider positive_match_data
- */
- public function test_positive_match($email)
- {
- $this->assertEquals(1, preg_match($this->regex, $email));
- }
-
- /**
- * @dataProvider negative_match_data
- */
- public function test_negative_match($email)
- {
- $this->assertEquals(0, preg_match($this->regex, $email));
- }
-}
-
diff --git a/tests/regex/email_test.php b/tests/regex/email_test.php
new file mode 100644
index 0000000000..5d6e207cbb
--- /dev/null
+++ b/tests/regex/email_test.php
@@ -0,0 +1,118 @@
+regex = '#^' . get_preg_expression('email') . '$#i';
+ }
+
+ public function positive_match_data()
+ {
+ return array(
+ array('nobody@phpbb.com'),
+ array('Nobody@sub.phpbb.com'),
+ array('alice.bob@foo.phpbb.com'),
+ array('alice-foo@bar.phpbb.com'),
+ array('alice_foo@bar.phpbb.com'),
+ array('alice+tag@foo.phpbb.com'),
+ array('alice&tag@foo.phpbb.com'),
+
+ //array('"John Doe"@example.com'),
+ //array('Alice@[192.168.2.1]'), // IPv4
+ //array('Bob@[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]'), // IPv6
+
+ // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
+ array('l3tt3rsAndNumb3rs@domain.com'),
+ array('has-dash@domain.com'),
+ array('hasApostrophe.o\'leary@domain.org'),
+ array('uncommonTLD@domain.museum'),
+ array('uncommonTLD@domain.travel'),
+ array('uncommonTLD@domain.mobi'),
+ array('countryCodeTLD@domain.uk'),
+ array('countryCodeTLD@domain.rw'),
+ array('numbersInDomain@911.com'),
+ array('underscore_inLocal@domain.net'),
+ array('IPInsteadOfDomain@127.0.0.1'),
+ array('IPAndPort@127.0.0.1:25'),
+ array('subdomain@sub.domain.com'),
+ array('local@dash-inDomain.com'),
+ array('dot.inLocal@foo.com'),
+ array('a@singleLetterLocal.org'),
+ array('singleLetterDomain@x.org'),
+ array('&*=?^+{}\'~@validCharsInLocal.net'),
+ array('foor@bar.newTLD'),
+ );
+ }
+
+ public function negative_match_data()
+ {
+ return array(
+ array('foo.example.com'), // @ is missing
+ array('.foo.example.com'), // . as first character
+ array('Foo.@example.com'), // . is last in local part
+ array('foo..123@example.com'), // . doubled
+ array('a@b@c@example.com'), // @ doubled
+
+ array('()[]\;:,<>@example.com'), // invalid characters
+ array('abc(def@example.com'), // invalid character (
+ array('abc)def@example.com'), // invalid character )
+ array('abc[def@example.com'), // invalid character [
+ array('abc]def@example.com'), // invalid character ]
+ array('abc\def@example.com'), // invalid character \
+ array('abc;def@example.com'), // invalid character ;
+ array('abc:def@example.com'), // invalid character :
+ array('abc,def@example.com'), // invalid character ,
+ array('abcdef@example.com'), // invalid character >
+
+ // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
+ array('missingDomain@.com'),
+ array('@missingLocal.org'),
+ array('missingatSign.net'),
+ array('missingDot@com'),
+ array('two@@signs.com'),
+ array('colonButNoPort@127.0.0.1:'),
+ array(''),
+ array('someone-else@127.0.0.1.26'),
+ array('.localStartsWithDot@domain.com'),
+ array('localEndsWithDot.@domain.com'),
+ array('two..consecutiveDots@domain.com'),
+ array('domainStartsWithDash@-domain.com'),
+ array('domainEndsWithDash@domain-.com'),
+ array('numbersInTLD@domain.c0m'),
+ array('missingTLD@domain.'),
+ array('! "#$%(),/;<>[]`|@invalidCharsInLocal.org'),
+ array('invalidCharsInDomain@! "#$%(),/;<>_[]`|.org'),
+ array('local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org'),
+ );
+ }
+
+ /**
+ * @dataProvider positive_match_data
+ */
+ public function test_positive_match($email)
+ {
+ $this->assertEquals(1, preg_match($this->regex, $email));
+ }
+
+ /**
+ * @dataProvider negative_match_data
+ */
+ public function test_negative_match($email)
+ {
+ $this->assertEquals(0, preg_match($this->regex, $email));
+ }
+}
+
diff --git a/tests/regex/ipv4.php b/tests/regex/ipv4.php
deleted file mode 100644
index 735a2c4384..0000000000
--- a/tests/regex/ipv4.php
+++ /dev/null
@@ -1,71 +0,0 @@
-regex = get_preg_expression('ipv4');
- }
-
- public function positive_match_data()
- {
- return array(
- array('0.0.0.0'),
- array('127.0.0.1'),
- array('192.168.0.1'),
- array('255.255.255.255'),
- );
- }
-
- public function negative_match_data()
- {
- return array(
- // IPv6 addresses
- array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'),
- array('2001:db8:85a3:c:d:8a2e:370:1337'),
- array('2001:db8:85a3::8a2e:370:1337'),
- array('2001:db8:0:1::192.168.0.2'),
- array('0:0:0:0:0:0:0:1'),
- array('0:0::0:0:1'),
- array('::1'),
-
- // Out of scope
- array('255.255.255.256'),
-
- // Other tests
- array('a.b.c.d'),
- array('11.22.33.'),
- array('11.22.33'),
- array('11.22'),
- array('11'),
- );
- }
-
- /**
- * @dataProvider positive_match_data
- */
- public function test_positive_match($address)
- {
- $this->assertEquals(1, preg_match($this->regex, $address));
- }
-
- /**
- * @dataProvider negative_match_data
- */
- public function test_negative_match($address)
- {
- $this->assertEquals(0, preg_match($this->regex, $address));
- }
-}
-
diff --git a/tests/regex/ipv4_test.php b/tests/regex/ipv4_test.php
new file mode 100644
index 0000000000..735a2c4384
--- /dev/null
+++ b/tests/regex/ipv4_test.php
@@ -0,0 +1,71 @@
+regex = get_preg_expression('ipv4');
+ }
+
+ public function positive_match_data()
+ {
+ return array(
+ array('0.0.0.0'),
+ array('127.0.0.1'),
+ array('192.168.0.1'),
+ array('255.255.255.255'),
+ );
+ }
+
+ public function negative_match_data()
+ {
+ return array(
+ // IPv6 addresses
+ array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'),
+ array('2001:db8:85a3:c:d:8a2e:370:1337'),
+ array('2001:db8:85a3::8a2e:370:1337'),
+ array('2001:db8:0:1::192.168.0.2'),
+ array('0:0:0:0:0:0:0:1'),
+ array('0:0::0:0:1'),
+ array('::1'),
+
+ // Out of scope
+ array('255.255.255.256'),
+
+ // Other tests
+ array('a.b.c.d'),
+ array('11.22.33.'),
+ array('11.22.33'),
+ array('11.22'),
+ array('11'),
+ );
+ }
+
+ /**
+ * @dataProvider positive_match_data
+ */
+ public function test_positive_match($address)
+ {
+ $this->assertEquals(1, preg_match($this->regex, $address));
+ }
+
+ /**
+ * @dataProvider negative_match_data
+ */
+ public function test_negative_match($address)
+ {
+ $this->assertEquals(0, preg_match($this->regex, $address));
+ }
+}
+
diff --git a/tests/regex/ipv6.php b/tests/regex/ipv6.php
deleted file mode 100644
index 187588f861..0000000000
--- a/tests/regex/ipv6.php
+++ /dev/null
@@ -1,142 +0,0 @@
-regex = get_preg_expression('ipv6');
- }
-
- public function positive_match_data()
- {
- return array(
- // Full length IPv6 address
- array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'),
- array('0000:0000:0000:0000:0000:0000:0000:0001'),
- array('3FFE:0b00:0000:0000:0001:0000:0000:000a'),
- array('3ffe:0b00:0000:0000:0001:0000:0000:000a'),
- array('2002:0db8:0000:0000:0000:dead:1337:d00d'),
-
- // No leading zeroes in the group
- array('2001:db8:85a3:0:0:8a2e:370:1337'),
- array('2001:db8:85a3:c:d:8a2e:370:1337'),
-
- // Consecutive all-zero groups
- array('2001:db8:85a3::8a2e:370:1337'),
- array('1::2:3:4:5:6:7'),
- array('1::2:3:4:5:6'),
- array('1::2:3:4:5'),
- array('1::2:3:4'),
- array('1::2:3'),
- array('1::2'),
-
- // Last 32bit in dotted quad notation
- array('2001:db8:0:1::192.168.0.2'),
-
- // IPv4-compatible IPv6 address
- array('::13.1.68.3'),
- array('0:0:0:0:0:0:13.1.68.3'),
-
- // IPv4-mapped IPv6 address
- array('::ffff:c000:280'),
- array('::ffff:c000:0280'),
- array('::ffff:192.0.2.128'),
- array('0:0:0:0:0:ffff:c000:280'),
- array('0:0:0:0:0:ffff:c000:0280'),
- array('0:0:0:0:0:ffff:192.0.2.128'),
- array('0000:0000:0000:0000:0000:ffff:c000:280'),
- array('0000:0000:0000:0000:0000:ffff:c000:0280'),
- array('0000:0000:0000:0000:0000:ffff:192.0.2.128'),
-
- // No trailing zeroes
- array('fe80::'),
- array('2002::'),
- array('2001:db8::'),
- array('2001:0db8:1234::'),
- array('1:2:3:4:5:6::'),
- array('1:2:3:4:5::'),
- array('1:2:3:4::'),
- array('1:2:3::'),
- array('1:2::'),
-
- // No leading zeroes
- array('::2:3:4:5:6:7:8'),
- array('::2:3:4:5:6:7'),
- array('::2:3:4:5:6'),
- array('::2:3:4:5'),
- array('::2:3:4'),
- array('::2:3'),
- array('::1'),
- array('::8'),
- array('::c'),
- array('::abcd'),
-
- // All zeroes
- array('::'),
- array('0:0:0:0:0:0:0:0'),
- array('0000:0000:0000:0000:0000:0000:0000:0000'),
-
- // More tests
- array('2::10'),
- array('0:0::0:0:1'),
- array('0:0:0:0:0:0:0:1'),
- array('::ffff:0:0'),
- );
- }
-
- public function negative_match_data()
- {
- return array(
- // Empty address
- array(''),
-
- // IPv4 address
- array('192.168.0.2'),
-
- // Out of scope
- array('abcd:efgh:0000::0'),
- array('::ffff:192.168.255.256'),
-
- // Double ::
- array('2001::23de::2002'),
- array('3ffe:b00::1::b'),
- array('::1111:2222:3333:4444:5555:6666::'),
-
- // Too many blocks
- array('2001:0db8:85a3:08d3:1319:8a2e:0370:1337:4430'),
-
- // More tests
- array('02001:0000:1234:0000:0000:C1C0:ABCD:9876'),
- array('2001:0000:1234: 0000:0000:C1C0:ABCD:9876'),
- array('::ffff:192x168.255.255'),
- );
- }
-
- /**
- * @dataProvider positive_match_data
- */
- public function test_positive_match($address)
- {
- $this->assertEquals(1, preg_match($this->regex, $address));
- }
-
- /**
- * @dataProvider negative_match_data
- */
- public function test_negative_match($address)
- {
- $this->assertEquals(0, preg_match($this->regex, $address));
- }
-}
-
diff --git a/tests/regex/ipv6_test.php b/tests/regex/ipv6_test.php
new file mode 100644
index 0000000000..187588f861
--- /dev/null
+++ b/tests/regex/ipv6_test.php
@@ -0,0 +1,142 @@
+regex = get_preg_expression('ipv6');
+ }
+
+ public function positive_match_data()
+ {
+ return array(
+ // Full length IPv6 address
+ array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'),
+ array('0000:0000:0000:0000:0000:0000:0000:0001'),
+ array('3FFE:0b00:0000:0000:0001:0000:0000:000a'),
+ array('3ffe:0b00:0000:0000:0001:0000:0000:000a'),
+ array('2002:0db8:0000:0000:0000:dead:1337:d00d'),
+
+ // No leading zeroes in the group
+ array('2001:db8:85a3:0:0:8a2e:370:1337'),
+ array('2001:db8:85a3:c:d:8a2e:370:1337'),
+
+ // Consecutive all-zero groups
+ array('2001:db8:85a3::8a2e:370:1337'),
+ array('1::2:3:4:5:6:7'),
+ array('1::2:3:4:5:6'),
+ array('1::2:3:4:5'),
+ array('1::2:3:4'),
+ array('1::2:3'),
+ array('1::2'),
+
+ // Last 32bit in dotted quad notation
+ array('2001:db8:0:1::192.168.0.2'),
+
+ // IPv4-compatible IPv6 address
+ array('::13.1.68.3'),
+ array('0:0:0:0:0:0:13.1.68.3'),
+
+ // IPv4-mapped IPv6 address
+ array('::ffff:c000:280'),
+ array('::ffff:c000:0280'),
+ array('::ffff:192.0.2.128'),
+ array('0:0:0:0:0:ffff:c000:280'),
+ array('0:0:0:0:0:ffff:c000:0280'),
+ array('0:0:0:0:0:ffff:192.0.2.128'),
+ array('0000:0000:0000:0000:0000:ffff:c000:280'),
+ array('0000:0000:0000:0000:0000:ffff:c000:0280'),
+ array('0000:0000:0000:0000:0000:ffff:192.0.2.128'),
+
+ // No trailing zeroes
+ array('fe80::'),
+ array('2002::'),
+ array('2001:db8::'),
+ array('2001:0db8:1234::'),
+ array('1:2:3:4:5:6::'),
+ array('1:2:3:4:5::'),
+ array('1:2:3:4::'),
+ array('1:2:3::'),
+ array('1:2::'),
+
+ // No leading zeroes
+ array('::2:3:4:5:6:7:8'),
+ array('::2:3:4:5:6:7'),
+ array('::2:3:4:5:6'),
+ array('::2:3:4:5'),
+ array('::2:3:4'),
+ array('::2:3'),
+ array('::1'),
+ array('::8'),
+ array('::c'),
+ array('::abcd'),
+
+ // All zeroes
+ array('::'),
+ array('0:0:0:0:0:0:0:0'),
+ array('0000:0000:0000:0000:0000:0000:0000:0000'),
+
+ // More tests
+ array('2::10'),
+ array('0:0::0:0:1'),
+ array('0:0:0:0:0:0:0:1'),
+ array('::ffff:0:0'),
+ );
+ }
+
+ public function negative_match_data()
+ {
+ return array(
+ // Empty address
+ array(''),
+
+ // IPv4 address
+ array('192.168.0.2'),
+
+ // Out of scope
+ array('abcd:efgh:0000::0'),
+ array('::ffff:192.168.255.256'),
+
+ // Double ::
+ array('2001::23de::2002'),
+ array('3ffe:b00::1::b'),
+ array('::1111:2222:3333:4444:5555:6666::'),
+
+ // Too many blocks
+ array('2001:0db8:85a3:08d3:1319:8a2e:0370:1337:4430'),
+
+ // More tests
+ array('02001:0000:1234:0000:0000:C1C0:ABCD:9876'),
+ array('2001:0000:1234: 0000:0000:C1C0:ABCD:9876'),
+ array('::ffff:192x168.255.255'),
+ );
+ }
+
+ /**
+ * @dataProvider positive_match_data
+ */
+ public function test_positive_match($address)
+ {
+ $this->assertEquals(1, preg_match($this->regex, $address));
+ }
+
+ /**
+ * @dataProvider negative_match_data
+ */
+ public function test_negative_match($address)
+ {
+ $this->assertEquals(0, preg_match($this->regex, $address));
+ }
+}
+
diff --git a/tests/regex/url.php b/tests/regex/url.php
deleted file mode 100644
index 246cbf549c..0000000000
--- a/tests/regex/url.php
+++ /dev/null
@@ -1,33 +0,0 @@
-assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#i', $url));
- }
-}
diff --git a/tests/regex/url_test.php b/tests/regex/url_test.php
new file mode 100644
index 0000000000..246cbf549c
--- /dev/null
+++ b/tests/regex/url_test.php
@@ -0,0 +1,33 @@
+assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#i', $url));
+ }
+}
diff --git a/tests/request/request_var.php b/tests/request/request_var.php
deleted file mode 100644
index 0901b43920..0000000000
--- a/tests/request/request_var.php
+++ /dev/null
@@ -1,180 +0,0 @@
-unset_variables($variable_name);
-
- $_POST[$variable_name] = $variable_value;
- $_REQUEST[$variable_name] = $variable_value;
-
- $result = request_var($variable_name, $default, $multibyte);
-
- $label = 'Requesting POST variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
- $this->assertEquals($expected, $result, $label);
- }
-
- /**
- * @dataProvider request_variables
- */
- public function test_get($variable_value, $default, $multibyte, $expected)
- {
- $variable_name = 'name';
- $this->unset_variables($variable_name);
-
- $_GET[$variable_name] = $variable_value;
- $_REQUEST[$variable_name] = $variable_value;
-
- $result = request_var($variable_name, $default, $multibyte);
-
- $label = 'Requesting GET variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
- $this->assertEquals($expected, $result, $label);
- }
-
- /**
- * @dataProvider request_variables
- */
- public function test_cookie($variable_value, $default, $multibyte, $expected)
- {
- $variable_name = 'name';
- $this->unset_variables($variable_name);
-
- $_GET[$variable_name] = false;
- $_POST[$variable_name] = false;
- $_REQUEST[$variable_name] = false;
- $_COOKIE[$variable_name] = $variable_value;
-
- $result = request_var($variable_name, $default, $multibyte, true);
-
- $label = 'Requesting COOKIE variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
- $this->assertEquals($expected, $result, $label);
- }
-
- /**
- * Helper for unsetting globals
- */
- private function unset_variables($var)
- {
- unset($_GET[$var], $_POST[$var], $_REQUEST[$var], $_COOKIE[$var]);
- }
-
- public static function request_variables()
- {
- return array(
- // strings
- array('abc', '', false, 'abc'),
- array(' some spaces ', '', true, 'some spaces'),
- array("\r\rsome\rcarriage\r\rreturns\r", '', true, "some\ncarriage\n\nreturns"),
- array("\n\nsome\ncarriage\n\nreturns\n", '', true, "some\ncarriage\n\nreturns"),
- array("\r\n\r\nsome\r\ncarriage\r\n\r\nreturns\r\n", '', true, "some\ncarriage\n\nreturns"),
- array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', true, "we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters"),
- array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', false, "we??rd???ch??r??acters"),
- array("Some \"entities\" like &", '', true, "Some <html> "entities" like &"),
-
- // integers
- array('1234', 0, false, 1234),
- array('abc', 12, false, 0),
- array('324abc', 0, false, 324),
-
- // string to array
- array('123', array(0), false, array()),
- array('123', array(''), false, array()),
-
- // 1 dimensional arrays
- array(
- // input:
- array('123', 'abc'),
- // default:
- array(''),
- false,
- // expected:
- array('123', 'abc')
- ),
- array(
- // input:
- array('123', 'abc'),
- // default:
- array(999),
- false,
- // expected:
- array(123, 0)
- ),
- array(
- // input:
- array('xyz' => '123', 'abc' => 'abc'),
- // default:
- array('' => ''),
- false,
- // expected:
- array('xyz' => '123', 'abc' => 'abc')
- ),
- array(
- // input:
- array('xyz' => '123', 'abc' => 'abc'),
- // default:
- array('' => 0),
- false,
- // expected:
- array('xyz' => 123, 'abc' => 0)
- ),
-
- // 2 dimensional arrays
- array(
- // input:
- '',
- // default:
- array(array(0)),
- false,
- // expected:
- array()
- ),
- array(
- // input:
- array(
- 'xyz' => array('123', 'def'),
- 'abc' => 'abc'
- ),
- // default:
- array('' => array('')),
- false,
- // expected:
- array(
- 'xyz' => array('123', 'def'),
- 'abc' => array()
- )
- ),
- array(
- // input:
- array(
- 'xyz' => array('123', 'def'),
- 'abc' => 'abc'
- ),
- // default:
- array('' => array(0)),
- false,
- // expected:
- array(
- 'xyz' => array(123, 0),
- 'abc' => array()
- )
- ),
- );
- }
-
-}
-
diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php
new file mode 100644
index 0000000000..0901b43920
--- /dev/null
+++ b/tests/request/request_var_test.php
@@ -0,0 +1,180 @@
+unset_variables($variable_name);
+
+ $_POST[$variable_name] = $variable_value;
+ $_REQUEST[$variable_name] = $variable_value;
+
+ $result = request_var($variable_name, $default, $multibyte);
+
+ $label = 'Requesting POST variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
+ $this->assertEquals($expected, $result, $label);
+ }
+
+ /**
+ * @dataProvider request_variables
+ */
+ public function test_get($variable_value, $default, $multibyte, $expected)
+ {
+ $variable_name = 'name';
+ $this->unset_variables($variable_name);
+
+ $_GET[$variable_name] = $variable_value;
+ $_REQUEST[$variable_name] = $variable_value;
+
+ $result = request_var($variable_name, $default, $multibyte);
+
+ $label = 'Requesting GET variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
+ $this->assertEquals($expected, $result, $label);
+ }
+
+ /**
+ * @dataProvider request_variables
+ */
+ public function test_cookie($variable_value, $default, $multibyte, $expected)
+ {
+ $variable_name = 'name';
+ $this->unset_variables($variable_name);
+
+ $_GET[$variable_name] = false;
+ $_POST[$variable_name] = false;
+ $_REQUEST[$variable_name] = false;
+ $_COOKIE[$variable_name] = $variable_value;
+
+ $result = request_var($variable_name, $default, $multibyte, true);
+
+ $label = 'Requesting COOKIE variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : '');
+ $this->assertEquals($expected, $result, $label);
+ }
+
+ /**
+ * Helper for unsetting globals
+ */
+ private function unset_variables($var)
+ {
+ unset($_GET[$var], $_POST[$var], $_REQUEST[$var], $_COOKIE[$var]);
+ }
+
+ public static function request_variables()
+ {
+ return array(
+ // strings
+ array('abc', '', false, 'abc'),
+ array(' some spaces ', '', true, 'some spaces'),
+ array("\r\rsome\rcarriage\r\rreturns\r", '', true, "some\ncarriage\n\nreturns"),
+ array("\n\nsome\ncarriage\n\nreturns\n", '', true, "some\ncarriage\n\nreturns"),
+ array("\r\n\r\nsome\r\ncarriage\r\n\r\nreturns\r\n", '', true, "some\ncarriage\n\nreturns"),
+ array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', true, "we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters"),
+ array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', false, "we??rd???ch??r??acters"),
+ array("Some \"entities\" like &", '', true, "Some <html> "entities" like &"),
+
+ // integers
+ array('1234', 0, false, 1234),
+ array('abc', 12, false, 0),
+ array('324abc', 0, false, 324),
+
+ // string to array
+ array('123', array(0), false, array()),
+ array('123', array(''), false, array()),
+
+ // 1 dimensional arrays
+ array(
+ // input:
+ array('123', 'abc'),
+ // default:
+ array(''),
+ false,
+ // expected:
+ array('123', 'abc')
+ ),
+ array(
+ // input:
+ array('123', 'abc'),
+ // default:
+ array(999),
+ false,
+ // expected:
+ array(123, 0)
+ ),
+ array(
+ // input:
+ array('xyz' => '123', 'abc' => 'abc'),
+ // default:
+ array('' => ''),
+ false,
+ // expected:
+ array('xyz' => '123', 'abc' => 'abc')
+ ),
+ array(
+ // input:
+ array('xyz' => '123', 'abc' => 'abc'),
+ // default:
+ array('' => 0),
+ false,
+ // expected:
+ array('xyz' => 123, 'abc' => 0)
+ ),
+
+ // 2 dimensional arrays
+ array(
+ // input:
+ '',
+ // default:
+ array(array(0)),
+ false,
+ // expected:
+ array()
+ ),
+ array(
+ // input:
+ array(
+ 'xyz' => array('123', 'def'),
+ 'abc' => 'abc'
+ ),
+ // default:
+ array('' => array('')),
+ false,
+ // expected:
+ array(
+ 'xyz' => array('123', 'def'),
+ 'abc' => array()
+ )
+ ),
+ array(
+ // input:
+ array(
+ 'xyz' => array('123', 'def'),
+ 'abc' => 'abc'
+ ),
+ // default:
+ array('' => array(0)),
+ false,
+ // expected:
+ array(
+ 'xyz' => array(123, 0),
+ 'abc' => array()
+ )
+ ),
+ );
+ }
+
+}
+
diff --git a/tests/security/extract_current_page.php b/tests/security/extract_current_page.php
deleted file mode 100644
index ff0ab4d1bb..0000000000
--- a/tests/security/extract_current_page.php
+++ /dev/null
@@ -1,53 +0,0 @@
-', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'),
- array('http://localhost/phpBB/index.php', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'),
- );
- }
-
- /**
- * @dataProvider security_variables
- */
- public function test_query_string_php_self($url, $query_string, $expected)
- {
- $_SERVER['PHP_SELF'] = $url;
- $_SERVER['QUERY_STRING'] = $query_string;
-
- $result = session::extract_current_page('./');
-
- $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.';
- $this->assertEquals($expected, $result['query_string'], $label);
- }
-
- /**
- * @dataProvider security_variables
- */
- public function test_query_string_request_uri($url, $query_string, $expected)
- {
- $_SERVER['REQUEST_URI'] = $url . '?' . $query_string;
- $_SERVER['QUERY_STRING'] = $query_string;
-
- $result = session::extract_current_page('./');
-
- $label = 'Running extract_current_page on ' . $query_string . ' with REQUEST_URI filled.';
- $this->assertEquals($expected, $result['query_string'], $label);
- }
-}
-
diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php
new file mode 100644
index 0000000000..ff0ab4d1bb
--- /dev/null
+++ b/tests/security/extract_current_page_test.php
@@ -0,0 +1,53 @@
+', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'),
+ array('http://localhost/phpBB/index.php', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'),
+ );
+ }
+
+ /**
+ * @dataProvider security_variables
+ */
+ public function test_query_string_php_self($url, $query_string, $expected)
+ {
+ $_SERVER['PHP_SELF'] = $url;
+ $_SERVER['QUERY_STRING'] = $query_string;
+
+ $result = session::extract_current_page('./');
+
+ $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.';
+ $this->assertEquals($expected, $result['query_string'], $label);
+ }
+
+ /**
+ * @dataProvider security_variables
+ */
+ public function test_query_string_request_uri($url, $query_string, $expected)
+ {
+ $_SERVER['REQUEST_URI'] = $url . '?' . $query_string;
+ $_SERVER['QUERY_STRING'] = $query_string;
+
+ $result = session::extract_current_page('./');
+
+ $label = 'Running extract_current_page on ' . $query_string . ' with REQUEST_URI filled.';
+ $this->assertEquals($expected, $result['query_string'], $label);
+ }
+}
+
diff --git a/tests/security/redirect.php b/tests/security/redirect.php
deleted file mode 100644
index c53414e7df..0000000000
--- a/tests/security/redirect.php
+++ /dev/null
@@ -1,60 +0,0 @@
- redirect(), expected triggered error (else false), expected returned result url (else false))
- return array(
- array('data://x', false, 'http://localhost/phpBB'),
- array('bad://localhost/phpBB/index.php', 'Tried to redirect to potentially insecure url.', false),
- array('http://www.otherdomain.com/somescript.php', false, 'http://localhost/phpBB'),
- array("http://localhost/phpBB/memberlist.php\n\rConnection: close", 'Tried to redirect to potentially insecure url.', false),
- array('javascript:test', false, 'http://localhost/phpBB/../javascript:test'),
- array('http://localhost/phpBB/index.php;url=', 'Tried to redirect to potentially insecure url.', false),
- );
- }
-
- protected function setUp()
- {
- parent::setUp();
-
- $GLOBALS['config'] = array(
- 'force_server_vars' => '0',
- );
- }
-
- /**
- * @dataProvider provider
- */
- public function test_redirect($test, $expected_error, $expected_result)
- {
- global $user;
-
- if ($expected_error !== false)
- {
- $this->setExpectedTriggerError(E_USER_ERROR, $expected_error);
- }
-
- $result = redirect($test, true);
-
- // only verify result if we did not expect an error
- if ($expected_error === false)
- {
- $this->assertEquals($expected_result, $result);
- }
- }
-}
-
diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php
new file mode 100644
index 0000000000..c53414e7df
--- /dev/null
+++ b/tests/security/redirect_test.php
@@ -0,0 +1,60 @@
+ redirect(), expected triggered error (else false), expected returned result url (else false))
+ return array(
+ array('data://x', false, 'http://localhost/phpBB'),
+ array('bad://localhost/phpBB/index.php', 'Tried to redirect to potentially insecure url.', false),
+ array('http://www.otherdomain.com/somescript.php', false, 'http://localhost/phpBB'),
+ array("http://localhost/phpBB/memberlist.php\n\rConnection: close", 'Tried to redirect to potentially insecure url.', false),
+ array('javascript:test', false, 'http://localhost/phpBB/../javascript:test'),
+ array('http://localhost/phpBB/index.php;url=', 'Tried to redirect to potentially insecure url.', false),
+ );
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $GLOBALS['config'] = array(
+ 'force_server_vars' => '0',
+ );
+ }
+
+ /**
+ * @dataProvider provider
+ */
+ public function test_redirect($test, $expected_error, $expected_result)
+ {
+ global $user;
+
+ if ($expected_error !== false)
+ {
+ $this->setExpectedTriggerError(E_USER_ERROR, $expected_error);
+ }
+
+ $result = redirect($test, true);
+
+ // only verify result if we did not expect an error
+ if ($expected_error === false)
+ {
+ $this->assertEquals($expected_result, $result);
+ }
+ }
+}
+
diff --git a/tests/template/template.php b/tests/template/template.php
deleted file mode 100644
index 35df17e4c6..0000000000
--- a/tests/template/template.php
+++ /dev/null
@@ -1,689 +0,0 @@
-assertTrue($this->template->display($handle, false));
- }
- catch (Exception $exception)
- {
- // reset the error level even when an error occured
- // PHPUnit turns trigger_error into exceptions as well
- error_reporting($error_level);
- ob_end_clean();
- throw $exception;
- }
-
- $result = self::trim_template_result(ob_get_clean());
-
- // reset error level
- error_reporting($error_level);
- return $result;
- }
-
- private static function trim_template_result($result)
- {
- return str_replace("\n\n", "\n", implode("\n", array_map('trim', explode("\n", trim($result)))));
- }
-
- private function setup_engine()
- {
- $this->template_path = dirname(__FILE__) . '/templates';
- $this->template = new template();
- $this->template->set_custom_template($this->template_path, 'tests');
- }
-
- protected function setUp()
- {
- // Test the engine can be used
- $this->setup_engine();
-
- if (!is_writable(dirname($this->template->cachepath)))
- {
- $this->markTestSkipped("Template cache directory is not writable.");
- }
-
- foreach (glob($this->template->cachepath . '*') as $file)
- {
- unlink($file);
- }
-
- $GLOBALS['config'] = array(
- 'load_tplcompile' => true,
- 'tpl_allow_php' => false,
- );
- }
-
- protected function tearDown()
- {
- if (is_object($this->template))
- {
- foreach (glob($this->template->cachepath . '*') as $file)
- {
- unlink($file);
- }
- }
- }
-
- /**
- * @todo put test data into templates/xyz.test
- */
- public static function template_data()
- {
- return array(
- /*
- array(
- '', // File
- array(), // vars
- array(), // block vars
- array(), // destroy
- '', // Expected result
- ),
- */
- array(
- 'basic.html',
- array(),
- array(),
- array(),
- "pass\npass\n",
- ),
- array(
- 'variable.html',
- array('VARIABLE' => 'value'),
- array(),
- array(),
- 'value',
- ),
- array(
- 'if.html',
- array(),
- array(),
- array(),
- '0',
- ),
- array(
- 'if.html',
- array('S_VALUE' => true),
- array(),
- array(),
- "1\n0",
- ),
- array(
- 'if.html',
- array('S_VALUE' => true, 'S_OTHER_VALUE' => true),
- array(),
- array(),
- '1',
- ),
- array(
- 'if.html',
- array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
- array(),
- array(),
- '2',
- ),
- array(
- 'loop.html',
- array(),
- array(),
- array(),
- "noloop\nnoloop",
- ),
- array(
- 'loop.html',
- array(),
- array('loop' => array(array())),
- array(),
- "loop\nloop",
- ),
- array(
- 'loop.html',
- array(),
- array('loop' => array(array(), array()), 'loop.block' => array(array())),
- array(),
- "loop\nloop\nloop\nloop",
- ),
- array(
- 'loop.html',
- array(),
- array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())),
- array(),
- "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1",
- ),
- array(
- 'loop_vars.html',
- array(),
- array('loop' => array(array('VARIABLE' => 'x'))),
- array(),
- "first\n0\nx\nset\nlast",
- ),/* no nested top level loops
- array(
- 'loop_vars.html',
- array(),
- array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))),
- array(),
- "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
- ),
- array(
- 'loop_vars.html',
- array(),
- array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
- array(),
- "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast\n0\n\n1\nlast inner\ninner loop",
- ),*/
- array(
- 'loop_advanced.html',
- array(),
- array('loop' => array(array(), array(), array(), array(), array(), array(), array())),
- array(),
- "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561",
- ),
- array(
- 'define.html',
- array(),
- array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
- array(),
- "xyz\nabc",
- ),
- array(
- 'expressions.html',
- array(),
- array(),
- array(),
- trim(str_repeat("pass", 39)),
- ),
- array(
- 'php.html',
- array(),
- array(),
- array(),
- '',
- ),
- array(
- 'include.html',
- array('VARIABLE' => 'value'),
- array(),
- array(),
- 'value',
- ),
- array(
- 'loop_vars.html',
- array(),
- array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
- array('loop'),
- '',
- ),/* no top level nested loops
- array(
- 'loop_vars.html',
- array(),
- array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
- array('loop.inner'),
- "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
- ),*/
- array(
- 'lang.html',
- array(),
- array(),
- array(),
- "{ VARIABLE }\n{ VARIABLE }",
- ),
- array(
- 'lang.html',
- array('L_VARIABLE' => "Value'"),
- array(),
- array(),
- "Value'\nValue\'",
- ),
- array(
- 'lang.html',
- array('LA_VARIABLE' => "Value'"),
- array(),
- array(),
- "{ VARIABLE }\nValue'",
- ),
- );
- }
-
- public function test_missing_file()
- {
- $filename = 'file_not_found.html';
-
- $this->template->set_filenames(array('test' => $filename));
- $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
-
- $expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path . '/../') . '/templates/' . $filename);
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
-
- $this->display('test');
- }
-
- public function test_empty_file()
- {
- $expecting = 'template->set_filenames: Empty filename specified for test';
-
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
- $this->template->set_filenames(array('test' => ''));
- }
-
- public function test_invalid_handle()
- {
- $expecting = 'template->_tpl_load(): No file specified for handle test';
- $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
-
- $this->display('test');
- }
-
- private function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $cache_file)
- {
- $this->template->set_filenames(array('test' => $file));
- $this->template->assign_vars($vars);
-
- foreach ($block_vars as $block => $loops)
- {
- foreach ($loops as $_vars)
- {
- $this->template->assign_block_vars($block, $_vars);
- }
- }
-
- foreach ($destroy as $block)
- {
- $this->template->destroy_block_vars($block);
- }
-
- try
- {
- $this->assertEquals($expected, $this->display('test'), "Testing $file");
- $this->assertFileExists($cache_file);
- }
- catch (ErrorException $e)
- {
- if (file_exists($cache_file))
- {
- copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
- }
-
- throw $e;
- }
-
- // For debugging
- if (self::PRESERVE_CACHE)
- {
- copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
- }
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_template($file, array $vars, array $block_vars, array $destroy, $expected)
- {
- global $phpEx;
- $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.' . $phpEx;
-
- $this->assertFileNotExists($cache_file);
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
-
- // Reset the engine state
- $this->setup_engine();
-
- $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
- }
-
- /**
- * @dataProvider template_data
- */
- public function test_assign_display($file, array $vars, array $block_vars, array $destroy, $expected)
- {
- $this->template->set_filenames(array(
- 'test' => $file,
- 'container' => 'variable.html',
- ));
- $this->template->assign_vars($vars);
-
- foreach ($block_vars as $block => $loops)
- {
- foreach ($loops as $_vars)
- {
- $this->template->assign_block_vars($block, $_vars);
- }
- }
-
- foreach ($destroy as $block)
- {
- $this->template->destroy_block_vars($block);
- }
-
- $error_level = error_reporting();
- error_reporting($error_level & ~E_NOTICE);
-
- $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
-
- $this->template->assign_display('test', 'VARIABLE', false);
-
- error_reporting($error_level);
-
- $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
- }
-
- public function test_php()
- {
- global $phpEx;
-
- $GLOBALS['config']['tpl_allow_php'] = true;
-
- $cache_file = $this->template->cachepath . 'php.html.' . $phpEx;
-
- $this->assertFileNotExists($cache_file);
-
- $this->run_template('php.html', array(), array(), array(), 'test', $cache_file);
-
- $GLOBALS['config']['tpl_allow_php'] = false;
- }
-
- public function test_includephp()
- {
- $this->markTestIncomplete('Include PHP test file paths are broken');
-
- $GLOBALS['config']['tpl_allow_php'] = true;
-
- $cache_file = $this->template->cachepath . 'includephp.html.' . PHP_EXT;
-
- $cwd = getcwd();
- chdir(dirname(__FILE__) . '/templates');
-
- $this->run_template('includephp.html', array(), array(), array(), 'testing included php', $cache_file);
-
- $this->template->set_filenames(array('test' => 'includephp.html'));
- $this->assertEquals('testing included php', $this->display('test'), "Testing $file");
-
- chdir($cwd);
-
- $GLOBALS['config']['tpl_allow_php'] = false;
- }
-
- public static function alter_block_array_data()
- {
- return array(
- array(
- 'outer',
- array('VARIABLE' => 'before'),
- false,
- 'insert',
- << 'after'),
- true,
- 'insert',
- << 'pos #1'),
- 1,
- 'insert',
- << 'pos #1'),
- 0,
- 'change',
- << 'before'),
- false,
- 'insert',
- << 'after'),
- true,
- 'insert',
- << 'pos #1'),
- 1,
- 'insert',
- << 'before'),
- false,
- 'insert',
- << 'before'),
- false,
- 'insert',
- << 'before'),
- false,
- 'insert',
- <<markTestIncomplete('Alter Block Test is broken');
-
- $this->template->set_filenames(array('test' => 'loop_nested.html'));
-
- // @todo Change this
- $this->template->assign_block_vars('outer', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer', array());
- $this->template->assign_block_vars('outer.middle', array());
- $this->template->assign_block_vars('outer.middle', array());
-
- $this->assertEquals("outer - 0/3\nmiddle - 0/2\nmiddle - 1/2\nouter - 1/3\nmiddle - 0/3\nmiddle - 1/3\nmiddle - 2/3\nouter - 2/3\nmiddle - 0/2\nmiddle - 1/2", $this->display('test'), 'Ensuring template is built correctly before modification');
-
- $this->template->alter_block_array($alter_block, $vararray, $key, $mode);
- $this->assertEquals($expect, $this->display('test'), $description);
- }
-}
-
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
new file mode 100644
index 0000000000..35df17e4c6
--- /dev/null
+++ b/tests/template/template_test.php
@@ -0,0 +1,689 @@
+assertTrue($this->template->display($handle, false));
+ }
+ catch (Exception $exception)
+ {
+ // reset the error level even when an error occured
+ // PHPUnit turns trigger_error into exceptions as well
+ error_reporting($error_level);
+ ob_end_clean();
+ throw $exception;
+ }
+
+ $result = self::trim_template_result(ob_get_clean());
+
+ // reset error level
+ error_reporting($error_level);
+ return $result;
+ }
+
+ private static function trim_template_result($result)
+ {
+ return str_replace("\n\n", "\n", implode("\n", array_map('trim', explode("\n", trim($result)))));
+ }
+
+ private function setup_engine()
+ {
+ $this->template_path = dirname(__FILE__) . '/templates';
+ $this->template = new template();
+ $this->template->set_custom_template($this->template_path, 'tests');
+ }
+
+ protected function setUp()
+ {
+ // Test the engine can be used
+ $this->setup_engine();
+
+ if (!is_writable(dirname($this->template->cachepath)))
+ {
+ $this->markTestSkipped("Template cache directory is not writable.");
+ }
+
+ foreach (glob($this->template->cachepath . '*') as $file)
+ {
+ unlink($file);
+ }
+
+ $GLOBALS['config'] = array(
+ 'load_tplcompile' => true,
+ 'tpl_allow_php' => false,
+ );
+ }
+
+ protected function tearDown()
+ {
+ if (is_object($this->template))
+ {
+ foreach (glob($this->template->cachepath . '*') as $file)
+ {
+ unlink($file);
+ }
+ }
+ }
+
+ /**
+ * @todo put test data into templates/xyz.test
+ */
+ public static function template_data()
+ {
+ return array(
+ /*
+ array(
+ '', // File
+ array(), // vars
+ array(), // block vars
+ array(), // destroy
+ '', // Expected result
+ ),
+ */
+ array(
+ 'basic.html',
+ array(),
+ array(),
+ array(),
+ "pass\npass\n",
+ ),
+ array(
+ 'variable.html',
+ array('VARIABLE' => 'value'),
+ array(),
+ array(),
+ 'value',
+ ),
+ array(
+ 'if.html',
+ array(),
+ array(),
+ array(),
+ '0',
+ ),
+ array(
+ 'if.html',
+ array('S_VALUE' => true),
+ array(),
+ array(),
+ "1\n0",
+ ),
+ array(
+ 'if.html',
+ array('S_VALUE' => true, 'S_OTHER_VALUE' => true),
+ array(),
+ array(),
+ '1',
+ ),
+ array(
+ 'if.html',
+ array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
+ array(),
+ array(),
+ '2',
+ ),
+ array(
+ 'loop.html',
+ array(),
+ array(),
+ array(),
+ "noloop\nnoloop",
+ ),
+ array(
+ 'loop.html',
+ array(),
+ array('loop' => array(array())),
+ array(),
+ "loop\nloop",
+ ),
+ array(
+ 'loop.html',
+ array(),
+ array('loop' => array(array(), array()), 'loop.block' => array(array())),
+ array(),
+ "loop\nloop\nloop\nloop",
+ ),
+ array(
+ 'loop.html',
+ array(),
+ array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())),
+ array(),
+ "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1",
+ ),
+ array(
+ 'loop_vars.html',
+ array(),
+ array('loop' => array(array('VARIABLE' => 'x'))),
+ array(),
+ "first\n0\nx\nset\nlast",
+ ),/* no nested top level loops
+ array(
+ 'loop_vars.html',
+ array(),
+ array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))),
+ array(),
+ "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
+ ),
+ array(
+ 'loop_vars.html',
+ array(),
+ array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
+ array(),
+ "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast\n0\n\n1\nlast inner\ninner loop",
+ ),*/
+ array(
+ 'loop_advanced.html',
+ array(),
+ array('loop' => array(array(), array(), array(), array(), array(), array(), array())),
+ array(),
+ "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561",
+ ),
+ array(
+ 'define.html',
+ array(),
+ array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
+ array(),
+ "xyz\nabc",
+ ),
+ array(
+ 'expressions.html',
+ array(),
+ array(),
+ array(),
+ trim(str_repeat("pass", 39)),
+ ),
+ array(
+ 'php.html',
+ array(),
+ array(),
+ array(),
+ '',
+ ),
+ array(
+ 'include.html',
+ array('VARIABLE' => 'value'),
+ array(),
+ array(),
+ 'value',
+ ),
+ array(
+ 'loop_vars.html',
+ array(),
+ array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
+ array('loop'),
+ '',
+ ),/* no top level nested loops
+ array(
+ 'loop_vars.html',
+ array(),
+ array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
+ array('loop.inner'),
+ "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
+ ),*/
+ array(
+ 'lang.html',
+ array(),
+ array(),
+ array(),
+ "{ VARIABLE }\n{ VARIABLE }",
+ ),
+ array(
+ 'lang.html',
+ array('L_VARIABLE' => "Value'"),
+ array(),
+ array(),
+ "Value'\nValue\'",
+ ),
+ array(
+ 'lang.html',
+ array('LA_VARIABLE' => "Value'"),
+ array(),
+ array(),
+ "{ VARIABLE }\nValue'",
+ ),
+ );
+ }
+
+ public function test_missing_file()
+ {
+ $filename = 'file_not_found.html';
+
+ $this->template->set_filenames(array('test' => $filename));
+ $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist');
+
+ $expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path . '/../') . '/templates/' . $filename);
+ $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+
+ $this->display('test');
+ }
+
+ public function test_empty_file()
+ {
+ $expecting = 'template->set_filenames: Empty filename specified for test';
+
+ $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+ $this->template->set_filenames(array('test' => ''));
+ }
+
+ public function test_invalid_handle()
+ {
+ $expecting = 'template->_tpl_load(): No file specified for handle test';
+ $this->setExpectedTriggerError(E_USER_ERROR, $expecting);
+
+ $this->display('test');
+ }
+
+ private function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $cache_file)
+ {
+ $this->template->set_filenames(array('test' => $file));
+ $this->template->assign_vars($vars);
+
+ foreach ($block_vars as $block => $loops)
+ {
+ foreach ($loops as $_vars)
+ {
+ $this->template->assign_block_vars($block, $_vars);
+ }
+ }
+
+ foreach ($destroy as $block)
+ {
+ $this->template->destroy_block_vars($block);
+ }
+
+ try
+ {
+ $this->assertEquals($expected, $this->display('test'), "Testing $file");
+ $this->assertFileExists($cache_file);
+ }
+ catch (ErrorException $e)
+ {
+ if (file_exists($cache_file))
+ {
+ copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
+ }
+
+ throw $e;
+ }
+
+ // For debugging
+ if (self::PRESERVE_CACHE)
+ {
+ copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file));
+ }
+ }
+
+ /**
+ * @dataProvider template_data
+ */
+ public function test_template($file, array $vars, array $block_vars, array $destroy, $expected)
+ {
+ global $phpEx;
+ $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.' . $phpEx;
+
+ $this->assertFileNotExists($cache_file);
+
+ $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
+
+ // Reset the engine state
+ $this->setup_engine();
+
+ $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
+ }
+
+ /**
+ * @dataProvider template_data
+ */
+ public function test_assign_display($file, array $vars, array $block_vars, array $destroy, $expected)
+ {
+ $this->template->set_filenames(array(
+ 'test' => $file,
+ 'container' => 'variable.html',
+ ));
+ $this->template->assign_vars($vars);
+
+ foreach ($block_vars as $block => $loops)
+ {
+ foreach ($loops as $_vars)
+ {
+ $this->template->assign_block_vars($block, $_vars);
+ }
+ }
+
+ foreach ($destroy as $block)
+ {
+ $this->template->destroy_block_vars($block);
+ }
+
+ $error_level = error_reporting();
+ error_reporting($error_level & ~E_NOTICE);
+
+ $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)");
+
+ $this->template->assign_display('test', 'VARIABLE', false);
+
+ error_reporting($error_level);
+
+ $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
+ }
+
+ public function test_php()
+ {
+ global $phpEx;
+
+ $GLOBALS['config']['tpl_allow_php'] = true;
+
+ $cache_file = $this->template->cachepath . 'php.html.' . $phpEx;
+
+ $this->assertFileNotExists($cache_file);
+
+ $this->run_template('php.html', array(), array(), array(), 'test', $cache_file);
+
+ $GLOBALS['config']['tpl_allow_php'] = false;
+ }
+
+ public function test_includephp()
+ {
+ $this->markTestIncomplete('Include PHP test file paths are broken');
+
+ $GLOBALS['config']['tpl_allow_php'] = true;
+
+ $cache_file = $this->template->cachepath . 'includephp.html.' . PHP_EXT;
+
+ $cwd = getcwd();
+ chdir(dirname(__FILE__) . '/templates');
+
+ $this->run_template('includephp.html', array(), array(), array(), 'testing included php', $cache_file);
+
+ $this->template->set_filenames(array('test' => 'includephp.html'));
+ $this->assertEquals('testing included php', $this->display('test'), "Testing $file");
+
+ chdir($cwd);
+
+ $GLOBALS['config']['tpl_allow_php'] = false;
+ }
+
+ public static function alter_block_array_data()
+ {
+ return array(
+ array(
+ 'outer',
+ array('VARIABLE' => 'before'),
+ false,
+ 'insert',
+ << 'after'),
+ true,
+ 'insert',
+ << 'pos #1'),
+ 1,
+ 'insert',
+ << 'pos #1'),
+ 0,
+ 'change',
+ << 'before'),
+ false,
+ 'insert',
+ << 'after'),
+ true,
+ 'insert',
+ << 'pos #1'),
+ 1,
+ 'insert',
+ << 'before'),
+ false,
+ 'insert',
+ << 'before'),
+ false,
+ 'insert',
+ << 'before'),
+ false,
+ 'insert',
+ <<markTestIncomplete('Alter Block Test is broken');
+
+ $this->template->set_filenames(array('test' => 'loop_nested.html'));
+
+ // @todo Change this
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer', array());
+ $this->template->assign_block_vars('outer.middle', array());
+ $this->template->assign_block_vars('outer.middle', array());
+
+ $this->assertEquals("outer - 0/3\nmiddle - 0/2\nmiddle - 1/2\nouter - 1/3\nmiddle - 0/3\nmiddle - 1/3\nmiddle - 2/3\nouter - 2/3\nmiddle - 0/2\nmiddle - 1/2", $this->display('test'), 'Ensuring template is built correctly before modification');
+
+ $this->template->alter_block_array($alter_block, $vararray, $key, $mode);
+ $this->assertEquals($expect, $this->display('test'), $description);
+ }
+}
+
diff --git a/tests/text_processing/make_clickable.php b/tests/text_processing/make_clickable.php
deleted file mode 100644
index 75a35daf82..0000000000
--- a/tests/text_processing/make_clickable.php
+++ /dev/null
@@ -1,104 +0,0 @@
- whether it should work
- $prefix_texts = array(
- '' => true,
- "np \n" => true,
- 'bp text ' => true,
- 'cp text>' => true,
- 'ep text.' => array('w' => false), // doesn't work for www. type urls, but for everything else
- );
- $suffix_texts = array(
- '' => true,
- "\n ns" => true,
- ' bs text.' => true,
- '>cs text' => true,
- '"ds text' => true,
- '. es text.' => true,
- ', fs text.' => true,
- );
-
- $urls = array(
- 'http://example.com' => array('tag' => 'm', 'url' => false, 'text' => false), // false means same as key
- 'http://example.com/' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://example.com/path?query=abc' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://example.com/1' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://example.com/some/very/long/path/with/over/55/characters?and=a&long=query&too=1' => array('tag' => 'm', 'url' => false, 'text' => 'http://example.com/some/very/long/path/ ... uery&too=1'),
- 'http://localhost' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://localhost/#abc' => array('tag' => 'm', 'url' => false, 'text' => false),
-
- 'www.example.com/path/' => array('tag' => 'w', 'url' => 'http://www.example.com/path/', 'text' => false),
- 'randomwww.example.com/path/' => false,
-
- 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://thisdomain.org/' => array('tag' => 'm', 'url' => false, 'text' => false),
- 'http://thisdomain.org/1' => array('tag' => 'l', 'url' => false, 'text' => '1'),
- 'http://thisdomain.org/path/some?query=abc#test' => array('tag' => 'l', 'url' => false, 'text' => 'path/some?query=abc#test'),
-
- 'javascript:www.example.com/' => false,
- );
-
- $test_data = array();
-
- // run the test for each combination
- foreach ($prefix_texts as $prefix => $prefix_success)
- {
- foreach ($suffix_texts as $suffix => $suffix_success)
- {
- foreach ($urls as $url => $url_type)
- {
- $input = $prefix . $url . $suffix;
- // no valid url => no change
- $output = $input;
-
- if (
- ($prefix_success && $suffix_success && is_array($url_type)) &&
- // handle except syntax for prefix/suffix
- (!is_array($prefix_success) || !isset($prefix_success[$url_type['tag']]) || $prefix_success[$url_type['tag']] == true) &&
- (!is_array($suffix_success) || !isset($suffix_success[$url_type['tag']]) || $suffix_success[$url_type['tag']] == true)
- )
- {
- // false means it's the same as the url, less typing
- $url_type['url'] = ($url_type['url']) ? $url_type['url'] : $url;
- $url_type['text'] = ($url_type['text']) ? $url_type['text'] : $url;
-
- $class = ($url_type['tag'] === 'l') ? 'postlink-local' : 'postlink';
-
- // replace the url with the desired output format
- $output = $prefix . '' . $url_type['text'] . ' ' . $suffix;
- }
- $test_data[] = array($input, $output);
- }
- }
- }
-
- return $test_data;
- }
-
- /**
- * @dataProvider make_clickable_data
- */
- public function test_make_clickable($input, $expected)
- {
- $result = make_clickable($input, 'http://thisdomain.org');
-
- $label = 'Making text clickable: ' . $input;
- $this->assertEquals($expected, $result, $label);
- }
-
-}
-
diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php
new file mode 100644
index 0000000000..75a35daf82
--- /dev/null
+++ b/tests/text_processing/make_clickable_test.php
@@ -0,0 +1,104 @@
+ whether it should work
+ $prefix_texts = array(
+ '' => true,
+ "np \n" => true,
+ 'bp text ' => true,
+ 'cp text>' => true,
+ 'ep text.' => array('w' => false), // doesn't work for www. type urls, but for everything else
+ );
+ $suffix_texts = array(
+ '' => true,
+ "\n ns" => true,
+ ' bs text.' => true,
+ '>cs text' => true,
+ '"ds text' => true,
+ '. es text.' => true,
+ ', fs text.' => true,
+ );
+
+ $urls = array(
+ 'http://example.com' => array('tag' => 'm', 'url' => false, 'text' => false), // false means same as key
+ 'http://example.com/' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://example.com/path?query=abc' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://example.com/1' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://example.com/some/very/long/path/with/over/55/characters?and=a&long=query&too=1' => array('tag' => 'm', 'url' => false, 'text' => 'http://example.com/some/very/long/path/ ... uery&too=1'),
+ 'http://localhost' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://localhost/#abc' => array('tag' => 'm', 'url' => false, 'text' => false),
+
+ 'www.example.com/path/' => array('tag' => 'w', 'url' => 'http://www.example.com/path/', 'text' => false),
+ 'randomwww.example.com/path/' => false,
+
+ 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://thisdomain.org/' => array('tag' => 'm', 'url' => false, 'text' => false),
+ 'http://thisdomain.org/1' => array('tag' => 'l', 'url' => false, 'text' => '1'),
+ 'http://thisdomain.org/path/some?query=abc#test' => array('tag' => 'l', 'url' => false, 'text' => 'path/some?query=abc#test'),
+
+ 'javascript:www.example.com/' => false,
+ );
+
+ $test_data = array();
+
+ // run the test for each combination
+ foreach ($prefix_texts as $prefix => $prefix_success)
+ {
+ foreach ($suffix_texts as $suffix => $suffix_success)
+ {
+ foreach ($urls as $url => $url_type)
+ {
+ $input = $prefix . $url . $suffix;
+ // no valid url => no change
+ $output = $input;
+
+ if (
+ ($prefix_success && $suffix_success && is_array($url_type)) &&
+ // handle except syntax for prefix/suffix
+ (!is_array($prefix_success) || !isset($prefix_success[$url_type['tag']]) || $prefix_success[$url_type['tag']] == true) &&
+ (!is_array($suffix_success) || !isset($suffix_success[$url_type['tag']]) || $suffix_success[$url_type['tag']] == true)
+ )
+ {
+ // false means it's the same as the url, less typing
+ $url_type['url'] = ($url_type['url']) ? $url_type['url'] : $url;
+ $url_type['text'] = ($url_type['text']) ? $url_type['text'] : $url;
+
+ $class = ($url_type['tag'] === 'l') ? 'postlink-local' : 'postlink';
+
+ // replace the url with the desired output format
+ $output = $prefix . '' . $url_type['text'] . ' ' . $suffix;
+ }
+ $test_data[] = array($input, $output);
+ }
+ }
+ }
+
+ return $test_data;
+ }
+
+ /**
+ * @dataProvider make_clickable_data
+ */
+ public function test_make_clickable($input, $expected)
+ {
+ $result = make_clickable($input, 'http://thisdomain.org');
+
+ $label = 'Making text clickable: ' . $input;
+ $this->assertEquals($expected, $result, $label);
+ }
+
+}
+
--
cgit v1.2.1
From e00c5544d260741c6639d9a005ea933888ee8317 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Mon, 10 Jan 2011 23:20:06 +0100
Subject: [ticket/9990] Integrate utf normalizer tests into test suite
PHPBB3-9990
---
.gitignore | 1 +
phpunit.xml.dist | 10 +-
tests/network/checkdnsrr_test.php | 3 +
tests/utf/data/.gitkeep | 0
tests/utf/normalizer_test.php | 318 ++++++++++++++++++++++++++++++++++++++
5 files changed, 330 insertions(+), 2 deletions(-)
create mode 100644 tests/utf/data/.gitkeep
create mode 100644 tests/utf/normalizer_test.php
diff --git a/.gitignore b/.gitignore
index 39b9e0a7f4..c417bf01c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ phpBB/images/avatars/upload/*
phpBB/store/*
tests/phpbb_unit_tests.sqlite2
tests/test_config.php
+tests/utf/data/*.txt
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 78c7fdd93a..de8134da8e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -2,7 +2,7 @@
./tests/
-
+
+
+
+ slow
+
+
+
./tests/
diff --git a/tests/network/checkdnsrr_test.php b/tests/network/checkdnsrr_test.php
index 427132e508..9410deaf64 100644
--- a/tests/network/checkdnsrr_test.php
+++ b/tests/network/checkdnsrr_test.php
@@ -9,6 +9,9 @@
require_once __DIR__ . '/../../phpBB/includes/functions.php';
+/**
+* @group slow
+*/
class phpbb_network_checkdnsrr_test extends phpbb_test_case
{
public function data_provider()
diff --git a/tests/utf/data/.gitkeep b/tests/utf/data/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php
new file mode 100644
index 0000000000..9a9011c0fe
--- /dev/null
+++ b/tests/utf/normalizer_test.php
@@ -0,0 +1,318 @@
+ array(
+ 'c2' => array('c1', 'c2', 'c3'),
+ 'c4' => array('c4', 'c5')
+ ),
+
+ /**
+ * NFD
+ * c3 == NFD(c1) == NFD(c2) == NFD(c3)
+ * c5 == NFD(c4) == NFD(c5)
+ */
+ 'NFD' => array(
+ 'c3' => array('c1', 'c2', 'c3'),
+ 'c5' => array('c4', 'c5')
+ ),
+
+ /**
+ * NFKC
+ * c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
+ */
+ 'NFKC' => array(
+ 'c4' => array('c1', 'c2', 'c3', 'c4', 'c5')
+ ),
+
+ /**
+ * NFKD
+ * c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
+ */
+ 'NFKD' => array(
+ 'c5' => array('c1', 'c2', 'c3', 'c4', 'c5')
+ )
+ );
+
+ $tested_chars = array();
+
+ $fp = fopen(__DIR__.'/data/NormalizationTest.txt', 'rb');
+ while (!feof($fp))
+ {
+ $line = fgets($fp);
+
+ if ($line[0] == '@')
+ {
+ continue;
+ }
+
+ if (!strpos(' 0123456789ABCDEF', $line[0]))
+ {
+ continue;
+ }
+
+ list($c1, $c2, $c3, $c4, $c5) = explode(';', $line);
+
+ if (!strpos($c1, ' '))
+ {
+ /**
+ * We are currently testing a single character, we add it to the list of
+ * characters we have processed so that we can exclude it when testing
+ * for invariants
+ */
+ $tested_chars[$c1] = 1;
+ }
+
+ foreach ($test_suite as $form => $serie)
+ {
+ foreach ($serie as $expected => $tests)
+ {
+ $hex_expected = ${$expected};
+ $utf_expected = $this->hexseq_to_utf($hex_expected);
+
+ foreach ($tests as $test)
+ {
+ $utf_result = $utf_expected;
+ call_user_func(array('utf_normalizer', $form), &$utf_result);
+
+ $hex_result = $this->utf_to_hexseq($utf_result);
+ $this->assertEquals($utf_expected, $utf_result, "$expected == $form($test) ($hex_expected != $hex_result)");
+ }
+ }
+ }
+ }
+ fclose($fp);
+
+ return $tested_chars;
+ }
+
+ /**
+ * @depends test_normalizer
+ */
+ public function test_invariants(array $tested_chars)
+ {
+ $fp = fopen(__DIR__.'/data/UnicodeData.txt', 'rb');
+
+ while (!feof($fp))
+ {
+ $line = fgets($fp, 1024);
+
+ if (!$pos = strpos($line, ';'))
+ {
+ continue;
+ }
+
+ $hex_tested = $hex_expected = substr($line, 0, $pos);
+
+ if (isset($tested_chars[$hex_tested]))
+ {
+ continue;
+ }
+
+ $utf_expected = $this->hex_to_utf($hex_expected);
+
+ if ($utf_expected >= UTF8_SURROGATE_FIRST
+ && $utf_expected <= UTF8_SURROGATE_LAST)
+ {
+ /**
+ * Surrogates are illegal on their own, we expect the normalizer
+ * to return a replacement char
+ */
+ $utf_expected = UTF8_REPLACEMENT;
+ $hex_expected = $this->utf_to_hexseq($utf_expected);
+ }
+
+ foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form)
+ {
+ $utf_result = $utf_expected;
+ call_user_func(array('utf_normalizer', $form), &$utf_result);
+ $hex_result = $this->utf_to_hexseq($utf_result);
+
+ $this->assertEquals($utf_expected, $utf_result, "$hex_expected == $form($hex_tested) ($hex_expected != $hex_result)");
+ }
+ }
+ fclose($fp);
+ }
+
+ /**
+ * Convert a UTF string to a sequence of codepoints in hexadecimal
+ *
+ * @param string $utf UTF string
+ * @return integer Unicode codepoints in hex
+ */
+ protected function utf_to_hexseq($str)
+ {
+ $pos = 0;
+ $len = strlen($str);
+ $ret = array();
+
+ while ($pos < $len)
+ {
+ $c = $str[$pos];
+ switch ($c & "\xF0")
+ {
+ case "\xC0":
+ case "\xD0":
+ $utf_char = substr($str, $pos, 2);
+ $pos += 2;
+ break;
+
+ case "\xE0":
+ $utf_char = substr($str, $pos, 3);
+ $pos += 3;
+ break;
+
+ case "\xF0":
+ $utf_char = substr($str, $pos, 4);
+ $pos += 4;
+ break;
+
+ default:
+ $utf_char = $c;
+ ++$pos;
+ }
+
+ $hex = dechex($this->utf_to_cp($utf_char));
+
+ if (!isset($hex[3]))
+ {
+ $hex = substr('000' . $hex, -4);
+ }
+
+ $ret[] = $hex;
+ }
+
+ return strtr(implode(' ', $ret), 'abcdef', 'ABCDEF');
+ }
+
+ /**
+ * Convert a UTF-8 char to its codepoint
+ *
+ * @param string $utf_char UTF-8 char
+ * @return integer Unicode codepoint
+ */
+ protected function utf_to_cp($utf_char)
+ {
+ switch (strlen($utf_char))
+ {
+ case 1:
+ return ord($utf_char);
+
+ case 2:
+ return ((ord($utf_char[0]) & 0x1F) << 6) | (ord($utf_char[1]) & 0x3F);
+
+ case 3:
+ return ((ord($utf_char[0]) & 0x0F) << 12) | ((ord($utf_char[1]) & 0x3F) << 6) | (ord($utf_char[2]) & 0x3F);
+
+ case 4:
+ return ((ord($utf_char[0]) & 0x07) << 18) | ((ord($utf_char[1]) & 0x3F) << 12) | ((ord($utf_char[2]) & 0x3F) << 6) | (ord($utf_char[3]) & 0x3F);
+
+ default:
+ throw new RuntimeException('UTF-8 chars can only be 1-4 bytes long');
+ }
+ }
+
+ /**
+ * Return a UTF string formed from a sequence of codepoints in hexadecimal
+ *
+ * @param string $seq Sequence of codepoints, separated with a space
+ * @return string UTF-8 string
+ */
+ protected function hexseq_to_utf($seq)
+ {
+ return implode('', array_map(array($this, 'hex_to_utf'), explode(' ', $seq)));
+ }
+
+ /**
+ * Convert a codepoint in hexadecimal to a UTF-8 char
+ *
+ * @param string $hex Codepoint, in hexadecimal
+ * @return string UTF-8 char
+ */
+ protected function hex_to_utf($hex)
+ {
+ return $this->cp_to_utf(hexdec($hex));
+ }
+
+ /**
+ * Convert a codepoint to a UTF-8 char
+ *
+ * @param integer $cp Unicode codepoint
+ * @return string UTF-8 string
+ */
+ protected function cp_to_utf($cp)
+ {
+ if ($cp > 0xFFFF)
+ {
+ return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F));
+ }
+ else if ($cp > 0x7FF)
+ {
+ return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F));
+ }
+ else if ($cp > 0x7F)
+ {
+ return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F));
+ }
+ else
+ {
+ return chr($cp);
+ }
+ }
+
+ // chunked download helper
+ static protected function download($url, $to)
+ {
+ $target = $to . '/' . basename($url);
+
+ if (file_exists($target))
+ {
+ return;
+ }
+
+ if (!$fpr = fopen($url, 'rb'))
+ {
+ throw new RuntimeException("Failed to download $url");
+ }
+
+ if (!$fpw = fopen($target, 'wb'))
+ {
+ throw new RuntimeException("Failed to open $target for writing");
+ }
+
+ $chunk = 32768;
+
+ while (!feof($fpr))
+ {
+ fwrite($fpw, fread($fpr, $chunk));
+ }
+ fclose($fpr);
+ fclose($fpw);
+ }
+}
--
cgit v1.2.1
From 42cf9a9895bf36ee6a0a1821aefd6e567b251552 Mon Sep 17 00:00:00 2001
From: Igor Wiedler
Date: Wed, 12 Jan 2011 02:22:37 +0100
Subject: [ticket/9990] Add docs for running slow tests
PHPBB3-9990
---
phpunit.xml.all | 25 +++++++++++++++++++++++++
tests/RUNNING_TESTS.txt | 9 +++++++++
2 files changed, 34 insertions(+)
create mode 100644 phpunit.xml.all
diff --git a/phpunit.xml.all b/phpunit.xml.all
new file mode 100644
index 0000000000..1be2830729
--- /dev/null
+++ b/phpunit.xml.all
@@ -0,0 +1,25 @@
+
+
+
+
+
+ ./tests/
+
+
+
+
+
+ ./tests/
+
+
+
diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt
index ac07978d3e..59197acc0f 100644
--- a/tests/RUNNING_TESTS.txt
+++ b/tests/RUNNING_TESTS.txt
@@ -50,6 +50,15 @@ Once the prerequisites are installed, run the tests from the project root direct
$ phpunit
+Slow tests
+--------------
+Certain tests, such as the UTF-8 normalizer or the DNS tests tend to be slow.
+Thus these tests are in the `slow` group, which is excluded by default. You can
+enable slow tests by copying the phpunit.xml.all file to phpunit.xml. If you only
+want the slow tests, run:
+
+ $ phpunit --group slow
+
More Information
================
--
cgit v1.2.1
From be3a0b269a7ddff2e5f0f2ae364cf2e50c780980 Mon Sep 17 00:00:00 2001
From: Andreas Fischer
Date: Sat, 15 Jan 2011 02:06:23 +0100
Subject: [ticket/9805] Script for easily cloning a whole github network.
PHPBB3-9805
---
git-tools/setup_github_network.php | 179 +++++++++++++++++++++++++++++++++++++
1 file changed, 179 insertions(+)
create mode 100644 git-tools/setup_github_network.php
diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php
new file mode 100644
index 0000000000..bc8e70cfbd
--- /dev/null
+++ b/git-tools/setup_github_network.php
@@ -0,0 +1,179 @@
+contributors as $contributor)
+ {
+ $usernames[$contributor->login] = $contributor->login;
+ }
+
+ return $usernames;
+}
+
+function get_organisation_members($username)
+{
+ $request = api_request("organizations/$username/public_members");
+
+ $usernames = array();
+ foreach ($request->users as $member)
+ {
+ $usernames[$member->login] = $member->login;
+ }
+
+ return $usernames;
+}
+
+function get_collaborators($username, $repository)
+{
+ $request = api_request("repos/show/$username/$repository/collaborators");
+
+ $usernames = array();
+ foreach ($request->collaborators as $collaborator)
+ {
+ $usernames[$collaborator] = $collaborator;
+ }
+
+ return $usernames;
+}
+
+function get_network($username, $repository)
+{
+ $request = api_request("repos/show/$username/$repository/network");
+
+ $usernames = array();
+ foreach ($request->network as $network)
+ {
+ $usernames[$network->owner] = array(
+ 'username' => $network->owner,
+ 'repository' => $network->name,
+ );
+ }
+
+ return $usernames;
+}
+
+function show_usage($argv)
+{
+ printf(
+ "usage: php %s collaborators|organisation|contributors|network [your_github_username]\n",
+ basename($argv[0])
+ );
+ exit(1);
+}
+
+function get_arg($argv, $index, $default)
+{
+ return isset($argv[$index]) ? $argv[$index] : $default;
+}
+
+function run($cmd)
+{
+ passthru(escapeshellcmd($cmd));
+}
--
cgit v1.2.1
From 2a703b40550129c668e7781aaa1a25612fd42902 Mon Sep 17 00:00:00 2001
From: Andreas Fischer
Date: Sun, 16 Jan 2011 17:27:08 +0100
Subject: [ticket/9859] Remove years in credit line from some more files.
Standard HTML output now includes:
Powered by phpBB © phpBB Group
Print output now includes:
Powered by phpBB © phpBB Group http://www.phpbb.com/
This also fixes an inconsistency where "phpBB Group" was linked instead of
"phpBB".
PHPBB3-9859
---
phpBB/adm/style/install_footer.html | 2 +-
phpBB/adm/style/overall_footer.html | 2 +-
phpBB/adm/style/simple_footer.html | 2 +-
phpBB/develop/create_variable_overview.php | 2 +-
phpBB/includes/db/dbal.php | 2 +-
phpBB/includes/functions.php | 2 +-
phpBB/install/database_update.php | 2 +-
phpBB/install/index.php | 2 +-
phpBB/styles/prosilver/template/simple_footer.html | 2 +-
phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html | 2 +-
phpBB/styles/prosilver/template/viewtopic_print.html | 2 +-
phpBB/styles/subsilver2/template/simple_footer.html | 2 +-
phpBB/styles/subsilver2/template/ucp_pm_viewmessage_print.html | 2 +-
phpBB/styles/subsilver2/template/viewtopic_print.html | 2 +-
14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/phpBB/adm/style/install_footer.html b/phpBB/adm/style/install_footer.html
index 4df43eaaa0..20fca423bf 100644
--- a/phpBB/adm/style/install_footer.html
+++ b/phpBB/adm/style/install_footer.html
@@ -19,7 +19,7 @@
// -->
diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html
index 8af299ad57..ac9e826dd8 100644
--- a/phpBB/adm/style/overall_footer.html
+++ b/phpBB/adm/style/overall_footer.html
@@ -20,7 +20,7 @@
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
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 69be1627cf..5def593bd6 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3834,7 +3834,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
echo ' ';
echo ' ';
echo ' ';
echo '';
echo '';
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()
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 ' ';
echo ' ';
echo ' ';
echo '';
echo '