aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-tools/hooks/pre-commit65
-rw-r--r--phpBB/adm/style/overall_footer.html5
-rw-r--r--phpBB/adm/style/simple_footer.html2
-rw-r--r--phpBB/includes/acp/acp_styles.php571
-rw-r--r--phpBB/includes/captcha/captcha_factory.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php2
-rw-r--r--phpBB/includes/extension/finder.php18
-rw-r--r--phpBB/includes/functions.php3
-rw-r--r--phpBB/includes/functions_acp.php1
-rw-r--r--phpBB/includes/functions_content.php2
-rw-r--r--phpBB/includes/functions_posting.php9
-rw-r--r--phpBB/includes/functions_user.php21
-rw-r--r--phpBB/includes/style/extension_path_provider.php36
-rw-r--r--phpBB/includes/style/path_provider.php16
-rw-r--r--phpBB/includes/style/path_provider_interface.php7
-rw-r--r--phpBB/includes/style/resource_locator.php134
-rw-r--r--phpBB/includes/style/style.php32
-rw-r--r--phpBB/includes/style/template.php57
-rw-r--r--phpBB/includes/style/template_compile.php18
-rw-r--r--phpBB/includes/style/template_filter.php61
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php9
-rw-r--r--phpBB/install/database_update.php28
-rw-r--r--phpBB/install/install_install.php3
-rw-r--r--phpBB/language/en/common.php3
-rw-r--r--phpBB/language/en/help_faq.php2
-rw-r--r--phpBB/language/en/mcp.php2
-rw-r--r--phpBB/language/en/posting.php1
-rw-r--r--phpBB/language/en/viewtopic.php2
-rw-r--r--phpBB/memberlist.php20
-rw-r--r--phpBB/posting.php6
-rw-r--r--phpBB/styles/prosilver/template/ajax.js11
-rw-r--r--phpBB/styles/prosilver/template/editor.js2
-rw-r--r--phpBB/styles/prosilver/template/mcp_topic.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_warn_front.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_warn_list.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html5
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html4
-rw-r--r--phpBB/styles/prosilver/template/quickreply_editor.html6
-rw-r--r--phpBB/styles/prosilver/template/simple_footer.html3
-rw-r--r--phpBB/styles/prosilver/theme/common.css8
-rw-r--r--phpBB/styles/prosilver/theme/cp.css16
-rw-r--r--phpBB/styles/prosilver/theme/tweaks.css14
-rw-r--r--phpBB/styles/subsilver2/template/editor.js2
-rw-r--r--phpBB/styles/subsilver2/template/mcp_warn_front.html4
-rw-r--r--phpBB/styles/subsilver2/template/mcp_warn_list.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_footer.html3
-rw-r--r--phpBB/styles/subsilver2/template/quickreply_editor.html4
-rw-r--r--phpBB/styles/subsilver2/template/simple_footer.html3
-rw-r--r--tests/dbal/select_test.php14
-rw-r--r--tests/dbal/write_test.php4
-rw-r--r--tests/group_positions/group_positions_test.php14
-rw-r--r--tests/request/request_var_test.php4
-rw-r--r--tests/security/extract_current_page_test.php2
-rw-r--r--tests/security/redirect_test.php2
-rw-r--r--tests/template/template_compile_test.php2
-rw-r--r--tests/template/template_includejs_test.php31
-rw-r--r--tests/template/template_inheritance_test.php22
-rw-r--r--tests/template/template_locate_test.php68
-rw-r--r--tests/template/template_test.php4
-rw-r--r--tests/template/template_test_case_with_tree.php29
-rw-r--r--tests/template/templates/includejs.html5
-rw-r--r--tests/text_processing/make_clickable_test.php2
-rw-r--r--tests/utf/utf8_clean_string_test.php2
67 files changed, 955 insertions, 491 deletions
diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit
index 4d03359773..03babe47cd 100755
--- a/git-tools/hooks/pre-commit
+++ b/git-tools/hooks/pre-commit
@@ -12,8 +12,17 @@
# ln -s ../../git-tools/hooks/pre-commit \\
# .git/hooks/pre-commit
-# NOTE: this is run through /usr/bin/env
-PHP_BIN=php
+if [ -z "$PHP_BIN" ]
+then
+ PHP_BIN=php
+fi
+
+if [ "$(echo -e test)" = test ]
+then
+ echo_e="echo -e"
+else
+ echo_e="echo"
+fi
# necessary check for initial commit
if git rev-parse --verify HEAD >/dev/null 2>&1
@@ -27,7 +36,7 @@ fi
error=0
errors=""
-if ! which $PHP_BIN >/dev/null 2>&1
+if ! which "$PHP_BIN" >/dev/null 2>&1
then
echo "PHP Syntax check failed:"
echo "PHP binary does not exist or is not in path: $PHP_BIN"
@@ -64,7 +73,13 @@ do
# check the staged file content for syntax errors
# using php -l (lint)
- result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null)
+ # note: if display_errors=stderr in php.ini,
+ # parse errors are printed on stderr; otherwise
+ # they are printed on stdout.
+ # we filter everything other than parse errors
+ # with a grep below, therefore it should be safe
+ # to combine stdout and stderr in all circumstances
+ result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1)
if [ $? -ne 0 ]
then
error=1
@@ -76,7 +91,45 @@ unset IFS
if [ $error -eq 1 ]
then
- echo -e "PHP Syntax check failed:";
- echo -e "$errors" | grep "^Parse error:"
+ echo "PHP Syntax check failed:"
+ # php "display errors" (display_errors php.ini value)
+ # and "log errors" (log_errors php.ini value).
+ # these are independent settings - see main/main.c in php source.
+ # the "log errors" setting produces output which
+ # starts with "PHP Parse error:"; the "display errors"
+ # setting produces output starting with "Parse error:".
+ # if both are turned on php dumps the parse error twice.
+ # therefore here we try to grep for one version and
+ # if that yields no results grep for the other version.
+ #
+ # other fun php facts:
+ #
+ # 1. in cli, display_errors and log_errors have different
+ # destinations by default. display_errors prints to
+ # standard output and log_errors prints to standard error.
+ # whether these destinations make sense is left
+ # as an exercise for the reader.
+ # 2. as mentioned above, with all output turned on
+ # php will print parse errors twice, one time on stdout
+ # and one time on stderr.
+ # 3. it is possible to set both display_errors and log_errors
+ # to off. if this is done php will print the text
+ # "Errors parsing <file>" but will not say what
+ # the errors are. useful behavior, this.
+ # 4. on my system display_errors defaults to on and
+ # log_errors defaults to off, therefore providing
+ # by default one copy of messages. your mileage may vary.
+ # 5. by setting display_errors=stderr and log_errors=on,
+ # both sets of messages will be printed on stderr.
+ # 6. php-cgi binary, given display_errors=stderr and
+ # log_errors=on, still prints both sets of messages
+ # on stderr, but formats one set as an html fragment.
+ # 7. your entry here? ;)
+ $echo_e "$errors" | grep "^Parse error:"
+ if [ $? -ne 0 ]
+ then
+ # match failed
+ $echo_e "$errors" | grep "^PHP Parse error:"
+ fi
exit 1
fi
diff --git a/phpBB/adm/style/overall_footer.html b/phpBB/adm/style/overall_footer.html
index 0337080f3d..0d88c8bcc5 100644
--- a/phpBB/adm/style/overall_footer.html
+++ b/phpBB/adm/style/overall_footer.html
@@ -9,7 +9,7 @@
<div id="page-footer">
<!-- IF S_COPYRIGHT_HTML -->
- Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ {CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- ENDIF -->
@@ -39,7 +39,8 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js"></script>
-<script type="text/javascript" src="style/ajax.js"></script>
+<!-- INCLUDEJS ajax.js -->
+{SCRIPTS}
</body>
</html>
diff --git a/phpBB/adm/style/simple_footer.html b/phpBB/adm/style/simple_footer.html
index 0d697aec1d..b6d7ee2f5c 100644
--- a/phpBB/adm/style/simple_footer.html
+++ b/phpBB/adm/style/simple_footer.html
@@ -5,7 +5,7 @@
<div id="page-footer">
<!-- IF S_COPYRIGHT_HTML -->
- <br />Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ <br />{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- ENDIF -->
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 2772fb2217..d33be274b4 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -20,31 +20,53 @@ if (!defined('IN_PHPBB'))
*/
class acp_styles
{
- var $u_action;
- var $u_base_action;
- var $s_hidden_fields;
- var $mode;
- var $styles_path;
- var $styles_path_absolute = 'styles';
-
- function main($id, $mode)
+ public $u_action;
+
+ protected $u_base_action;
+ protected $s_hidden_fields;
+ protected $mode;
+ protected $styles_path;
+ protected $styles_path_absolute = 'styles';
+ protected $default_style = 0;
+
+ protected $db;
+ protected $user;
+ protected $template;
+ protected $request;
+ protected $cache;
+ protected $auth;
+ protected $phpbb_root_path;
+ protected $phpEx;
+
+ public function main($id, $mode)
{
- global $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request;
+ global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config;
+
+ $this->db = $db;
+ $this->user = $user;
+ $this->template = $template;
+ $this->request = $request;
+ $this->cache = $cache;
+ $this->auth = $auth;
+ $this->config = $config;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->phpEx = $phpEx;
- $this->styles_path = $phpbb_root_path . $this->styles_path_absolute . '/';
+ $this->default_style = $config['default_style'];
+ $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/';
$this->u_base_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$id}");
$this->s_hidden_fields = array(
'mode' => $mode,
);
- $user->add_lang('acp/styles');
+ $this->user->add_lang('acp/styles');
$this->tpl_name = 'acp_styles';
$this->page_title = 'ACP_CAT_STYLES';
$this->mode = $mode;
- $action = $request->variable('action', '');
+ $action = $this->request->variable('action', '');
$post_actions = array('install', 'activate', 'deactivate', 'uninstall');
foreach ($post_actions as $key)
{
@@ -58,12 +80,12 @@ class acp_styles
$this->s_hidden_fields['action'] = $action;
}
- $template->assign_vars(array(
+ $this->template->assign_vars(array(
'U_ACTION' => $this->u_base_action,
'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields)
)
);
-
+
// Execute actions
switch ($action)
{
@@ -86,11 +108,11 @@ class acp_styles
$this->frontend();
}
}
-
+
/**
* Main page
*/
- function frontend()
+ protected function frontend()
{
// Check mode
switch ($this->mode)
@@ -107,41 +129,36 @@ class acp_styles
$this->action_cache();
return;
}
- global $user;
- trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
/**
* Purge cache
*/
- function action_cache()
+ protected function action_cache()
{
- global $cache, $auth, $user;
-
- $cache->purge();
+ $this->cache->purge();
// Clear permissions
- $auth->acl_clear_prefetch();
+ $this->auth->acl_clear_prefetch();
cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE');
-
- trigger_error($user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE);
+
+ trigger_error($this->user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE);
}
-
+
/**
* Install style(s)
*/
- function action_install()
+ protected function action_install()
{
- global $user;
-
// Get list of styles to install
$dirs = $this->request_vars('dir', '', true);
-
+
// Get list of styles that can be installed
$styles = $this->find_available(false);
-
+
// Install each style
$messages = array();
$installed_names = array();
@@ -166,52 +183,50 @@ class acp_styles
$last_installed = $style['style_id'];
$installed_names[] = $style['style_name'];
$installed_dirs[] = $style['style_path'];
- $messages[] = sprintf($user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name']));
+ $messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name']));
}
}
if (!$found)
{
- $messages[] = sprintf($user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir));
+ $messages[] = sprintf($this->user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir));
}
}
-
+
// Show message
if (!count($messages))
{
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$message = implode('<br />', $messages);
- $message .= '<br /><br />' . sprintf($user->lang['STYLE_INSTALLED_RETURN_STYLES'], $this->u_base_action . '&amp;mode=style');
- $message .= '<br /><br />' . sprintf($user->lang['STYLE_INSTALLED_RETURN_UNINSTALLED'], $this->u_base_action . '&amp;mode=install');
+ $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_STYLES'], $this->u_base_action . '&amp;mode=style');
+ $message .= '<br /><br />' . sprintf($this->user->lang['STYLE_INSTALLED_RETURN_UNINSTALLED'], $this->u_base_action . '&amp;mode=install');
trigger_error($message, E_USER_NOTICE);
}
-
+
/**
* Confirm styles removal
*/
- function action_uninstall()
+ protected function action_uninstall()
{
- global $user, $config, $template, $request;
-
// Get list of styles to uninstall
$ids = $this->request_vars('id', 0, true);
-
+
// Check if confirmation box was submitted
if (confirm_box(true))
{
// Uninstall
- $this->action_uninstall_confirmed($ids, $request->variable('confirm_delete_files', false));
+ $this->action_uninstall_confirmed($ids, $this->request->variable('confirm_delete_files', false));
return;
}
-
+
// Confirm box
$s_hidden = build_hidden_fields(array(
'action' => 'uninstall',
'ids' => $ids
));
- $template->assign_var('S_CONFIRM_DELETE', true);
- confirm_box(false, $user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html');
-
+ $this->template->assign_var('S_CONFIRM_DELETE', true);
+ confirm_box(false, $this->user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html');
+
// Canceled - show styles list
$this->frontend();
}
@@ -222,11 +237,9 @@ class acp_styles
* @param array $ids List of style IDs
* @param bool $delete_files If true, script will attempt to remove files for selected styles
*/
- function action_uninstall_confirmed($ids, $delete_files)
+ protected function action_uninstall_confirmed($ids, $delete_files)
{
- global $db, $user, $cache, $config;
-
- $default = $config['default_style'];
+ $default = $this->default_style;
$uninstalled = array();
$messages = array();
@@ -235,11 +248,11 @@ class acp_styles
{
if (!$id)
{
- trigger_error($user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if ($id == $default)
{
- trigger_error($user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$uninstalled[$id] = false;
}
@@ -250,10 +263,10 @@ class acp_styles
FROM ' . STYLES_TABLE . '
WHERE style_id IN (' . implode(', ', $ids) . ')
ORDER BY style_id DESC';
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
- $rows = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
// Uinstall each style
$uninstalled = array();
@@ -266,20 +279,20 @@ class acp_styles
$messages[] = $result;
continue;
}
- $messages[] = sprintf($user->lang['STYLE_UNINSTALLED'], $style['style_name']);
+ $messages[] = sprintf($this->user->lang['STYLE_UNINSTALLED'], $style['style_name']);
$uninstalled[] = $style['style_name'];
// Attempt to delete files
if ($delete_files)
{
- $messages[] = sprintf($user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']);
+ $messages[] = sprintf($this->user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']);
}
}
if (empty($messages))
{
// Nothing to uninstall?
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// Log action
@@ -289,7 +302,7 @@ class acp_styles
}
// Clear cache
- $cache->purge();
+ $this->cache->purge();
// Show message
trigger_error(implode('<br />', $messages) . adm_back_link($this->u_action), E_USER_NOTICE);
@@ -298,22 +311,20 @@ class acp_styles
/**
* Activate styles
*/
- function action_activate()
+ protected function action_activate()
{
- global $user, $config, $cache, $db;
-
// Get list of styles to activate
$ids = $this->request_vars('id', 0, true);
-
+
// Activate styles
$sql = 'UPDATE ' . STYLES_TABLE . '
SET style_active = 1
WHERE style_id IN (' . implode(', ', $ids) . ')';
- $db->sql_query($sql);
+ $this->db->sql_query($sql);
// Purge cache
- $cache->destroy('sql', STYLES_TABLE);
-
+ $this->cache->destroy('sql', STYLES_TABLE);
+
// Show styles list
$this->frontend();
}
@@ -321,19 +332,17 @@ class acp_styles
/**
* Deactivate styles
*/
- function action_deactivate()
+ protected function action_deactivate()
{
- global $user, $config, $cache, $db;
-
// Get list of styles to deactivate
$ids = $this->request_vars('id', 0, true);
// Check for default style
foreach ($ids as $id)
{
- if ($id == $config['default_style'])
+ if ($id == $this->default_style)
{
- trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);
}
}
@@ -341,38 +350,36 @@ class acp_styles
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = 0
WHERE user_style IN (' . implode(', ', $ids) . ')';
- $db->sql_query($sql);
+ $this->db->sql_query($sql);
// Deactivate styles
$sql = 'UPDATE ' . STYLES_TABLE . '
SET style_active = 0
WHERE style_id IN (' . implode(', ', $ids) . ')';
- $db->sql_query($sql);
+ $this->db->sql_query($sql);
// Purge cache
- $cache->destroy('sql', STYLES_TABLE);
+ $this->cache->destroy('sql', STYLES_TABLE);
// Show styles list
$this->frontend();
}
-
+
/**
* Show style details
*/
- function action_details()
+ protected function action_details()
{
- global $user, $config, $db, $request, $template, $cache;
-
- $id = $request->variable('id', 0);
+ $id = $this->request->variable('id', 0);
if (!$id)
{
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
// Get all styles
$styles = $this->get_styles();
- usort($styles, 'acp_styles::sort_styles');
-
+ usort($styles, array($this, 'sort_styles'));
+
// Find current style
$style = false;
foreach ($styles as $row)
@@ -386,34 +393,43 @@ class acp_styles
if ($style === false)
{
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
+
// Find all available parent styles
$list = $this->find_possible_parents($styles, $id);
-
+
+ // Add form key
+ $form_key = 'acp_styles';
+ add_form_key($form_key);
+
// Change data
- if ($request->variable('update', false))
+ if ($this->request->variable('update', false))
{
+ if (!check_form_key($form_key))
+ {
+ trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
$update = array(
- 'style_name' => trim($request->variable('style_name', $style['style_name'])),
- 'style_parent_id' => $request->variable('style_parent', (int) $style['style_parent_id']),
- 'style_active' => $request->variable('style_active', (int) $style['style_active']),
+ 'style_name' => trim($this->request->variable('style_name', $style['style_name'])),
+ 'style_parent_id' => $this->request->variable('style_parent', (int) $style['style_parent_id']),
+ 'style_active' => $this->request->variable('style_active', (int) $style['style_active']),
);
$update_action = $this->u_action . '&amp;action=details&amp;id=' . $id;
-
+
// Check style name
if ($update['style_name'] != $style['style_name'])
{
if (!strlen($update['style_name']))
{
- trigger_error($user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING);
+ trigger_error($this->user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING);
}
foreach ($styles as $row)
{
if ($row['style_name'] == $update['style_name'])
{
- trigger_error($user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING);
+ trigger_error($this->user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING);
}
}
}
@@ -421,7 +437,7 @@ class acp_styles
{
unset($update['style_name']);
}
-
+
// Check parent style id
if ($update['style_parent_id'] != $style['style_parent_id'])
{
@@ -439,7 +455,7 @@ class acp_styles
}
if (!$found)
{
- trigger_error($user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING);
+ trigger_error($this->user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING);
}
}
else
@@ -451,64 +467,64 @@ class acp_styles
{
unset($update['style_parent_id']);
}
-
+
// Check style_active
if ($update['style_active'] != $style['style_active'])
{
- if (!$update['style_active'] && $config['default_style'] == $style['style_id'])
+ if (!$update['style_active'] && $this->default_style == $style['style_id'])
{
- trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING);
+ trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING);
}
}
else
{
unset($update['style_active']);
}
-
+
// Update data
if (count($update))
{
$sql = 'UPDATE ' . STYLES_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $update) . "
+ SET ' . $this->db->sql_build_array('UPDATE', $update) . "
WHERE style_id = $id";
- $db->sql_query($sql);
-
+ $this->db->sql_query($sql);
+
$style = array_merge($style, $update);
-
+
if (isset($update['style_parent_id']))
{
// Update styles tree
$styles = $this->get_styles();
- if ($this->update_styles_tree(&$styles, $style))
+ if ($this->update_styles_tree($styles, $style))
{
// Something was changed in styles tree, purge all cache
- $cache->purge();
+ $this->cache->purge();
}
}
add_log('admin', 'LOG_STYLE_EDIT_DETAILS', $style['style_name']);
}
-
+
// Update default style
- $default = $request->variable('style_default', 0);
+ $default = $this->request->variable('style_default', 0);
if ($default)
{
if (!$style['style_active'])
{
- trigger_error($user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING);
+ trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING);
}
set_config('default_style', $id);
- $cache->purge();
+ $this->cache->purge();
}
-
+
// Show styles list
$this->frontend();
return;
}
-
+
// Show parent styles
foreach ($list as $row)
{
- $template->assign_block_vars('parent_styles', array(
+ $this->template->assign_block_vars('parent_styles', array(
'STYLE_ID' => $row['style_id'],
'STYLE_NAME' => htmlspecialchars($row['style_name']),
'LEVEL' => $row['level'],
@@ -516,9 +532,9 @@ class acp_styles
)
);
}
-
+
// Show style details
- $template->assign_vars(array(
+ $this->template->assign_vars(array(
'S_STYLE_DETAILS' => true,
'STYLE_ID' => $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name']),
@@ -526,7 +542,7 @@ class acp_styles
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_PARENT' => $style['style_parent_id'],
'S_STYLE_ACTIVE' => $style['style_active'],
- 'S_STYLE_DEFAULT' => ($style['style_id'] == $config['default_style'])
+ 'S_STYLE_DEFAULT' => ($style['style_id'] == $this->default_style)
)
);
}
@@ -534,65 +550,63 @@ class acp_styles
/**
* List installed styles
*/
- function show_installed()
+ protected function show_installed()
{
- global $user, $template;
-
// Get all installed styles
$styles = $this->get_styles();
if (!count($styles))
{
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
-
- usort($styles, 'acp_styles::sort_styles');
+
+ usort($styles, array($this, 'sort_styles'));
// Get users
$users = $this->get_users();
-
+
// Add users counter to rows
foreach ($styles as &$style)
{
$style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0;
}
-
+
// Set up styles list variables
// Addons should increase this number and update template variable
$this->styles_list_cols = 4;
- $template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols);
+ $this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols);
// Show styles list
- $this->show_styles_list(&$styles, 0, 0);
-
+ $this->show_styles_list($styles, 0, 0);
+
// Show styles with invalid inherits_id
foreach ($styles as $style)
{
if (empty($style['_shown']))
{
- $style['_note'] = sprintf($user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree']));
+ $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree']));
$this->list_style($style, 0);
}
}
// Add buttons
- $template->assign_block_vars('extra_actions', array(
+ $this->template->assign_block_vars('extra_actions', array(
'ACTION_NAME' => 'activate',
- 'L_ACTION' => $user->lang['STYLE_ACTIVATE'],
+ 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE'],
)
);
- $template->assign_block_vars('extra_actions', array(
+ $this->template->assign_block_vars('extra_actions', array(
'ACTION_NAME' => 'deactivate',
- 'L_ACTION' => $user->lang['STYLE_DEACTIVATE'],
+ 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE'],
)
);
if (isset($this->style_counters) && $this->style_counters['total'] > 1)
{
- $template->assign_block_vars('extra_actions', array(
+ $this->template->assign_block_vars('extra_actions', array(
'ACTION_NAME' => 'uninstall',
- 'L_ACTION' => $user->lang['STYLE_UNINSTALL'],
+ 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'],
)
);
}
@@ -601,28 +615,26 @@ class acp_styles
/**
* Show list of styles that can be installed
*/
- function show_available()
+ protected function show_available()
{
- global $user, $template;
-
// Get list of styles
$styles = $this->find_available(true);
-
+
// Show styles
if (empty($styles))
{
- trigger_error($user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE);
+ trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE);
}
-
- usort($styles, 'acp_styles::sort_styles');
+
+ usort($styles, array($this, 'sort_styles'));
$this->styles_list_cols = 3;
- $template->assign_vars(array(
+ $this->template->assign_vars(array(
'STYLES_LIST_COLS' => $this->styles_list_cols,
'STYLES_LIST_HIDE_COUNT' => true
)
);
-
+
// Show styles
foreach ($styles as &$style)
{
@@ -641,41 +653,39 @@ class acp_styles
}
if (!$has_parent)
{
- $this->list_style(&$style, 0);
- $this->show_available_child_styles(&$styles, $style['style_name'], 1);
+ $this->list_style($style, 0);
+ $this->show_available_child_styles($styles, $style['style_name'], 1);
}
}
-
+
// Show styles that do not have parent style in styles list
foreach ($styles as $style)
{
if (empty($style['_shown']))
{
- $this->list_style(&$style, 0);
+ $this->list_style($style, 0);
}
}
-
+
// Add button
if (isset($this->style_counters) && $this->style_counters['caninstall'] > 0)
{
- $template->assign_block_vars('extra_actions', array(
+ $this->template->assign_block_vars('extra_actions', array(
'ACTION_NAME' => 'install',
- 'L_ACTION' => $user->lang['INSTALL_STYLES'],
+ 'L_ACTION' => $this->user->lang['INSTALL_STYLES'],
)
);
}
}
-
+
/**
* Find styles available for installation
*
* @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed
- * @returns array list of styles
+ * @return array List of styles
*/
- function find_available($all)
+ protected function find_available($all)
{
- global $user;
-
// Get list of installed styles
$installed = $this->get_styles();
@@ -691,10 +701,10 @@ class acp_styles
'tree' => (strlen($style['style_parent_tree']) ? $style['style_parent_tree'] . '/' : '') . $style['style_path'],
);
}
-
+
// Get list of directories
$dirs = $this->find_style_dirs();
-
+
// Find styles that can be installed
$styles = array();
foreach ($dirs as $dir)
@@ -743,10 +753,10 @@ class acp_styles
{
// Parent style is not installed yet
$style['_available'] = false;
- $style['_note'] = sprintf($user->lang['REQUIRES_STYLE'], htmlspecialchars($parent));
+ $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($parent));
}
}
-
+
if ($all || $style['_available'])
{
$styles[] = $style;
@@ -755,7 +765,7 @@ class acp_styles
return $styles;
}
-
+
/**
* Show styles list
*
@@ -763,18 +773,18 @@ class acp_styles
* @param int $parent parent style id
* @param int $level style inheritance level
*/
- function show_styles_list($styles, $parent, $level)
+ protected function show_styles_list(&$styles, $parent, $level)
{
foreach ($styles as &$style)
{
if (empty($style['_shown']) && $style['style_parent_id'] == $parent)
{
- $this->list_style(&$style, $level);
- $this->show_styles_list(&$styles, $style['style_id'], $level + 1);
+ $this->list_style($style, $level);
+ $this->show_styles_list($styles, $style['style_id'], $level + 1);
}
}
}
-
+
/**
* Show available styles tree
*
@@ -782,26 +792,26 @@ class acp_styles
* @param string $name Name of parent style
* @param string $level Styles tree level
*/
- function show_available_child_styles($styles, $name, $level)
+ protected function show_available_child_styles(&$styles, $name, $level)
{
foreach ($styles as &$style)
{
if (empty($style['_shown']) && $style['_inherit_name'] == $name)
{
- $this->list_style(&$style, $level);
- $this->show_available_child_styles(&$styles, $style['style_name'], $level + 1);
+ $this->list_style($style, $level);
+ $this->show_available_child_styles($styles, $style['style_name'], $level + 1);
}
}
}
-
+
/**
* Update styles tree
*
* @param array $styles Styles list, passed as reference
* @param array $style Current style, false if root
- * @returns true if something was updated, false if not
+ * @return bool True if something was updated, false if not
*/
- function update_styles_tree($styles, $style = false)
+ protected function update_styles_tree(&$styles, $style = false)
{
$parent_id = ($style === false) ? 0 : $style['style_id'];
$parent_tree = ($style === false) ? '' : ($style['style_parent_tree'] == '' ? '' : $style['style_parent_tree']) . $style['style_path'];
@@ -816,21 +826,20 @@ class acp_styles
$row['style_parent_tree'] = $parent_tree;
$update = true;
}
- $updated |= $this->update_styles_tree(&$styles, $row);
+ $updated |= $this->update_styles_tree($styles, $row);
}
}
if ($update)
{
- global $db;
$sql = 'UPDATE ' . STYLES_TABLE . "
- SET style_parent_tree = '" . $db->sql_escape($parent_tree) . "'
+ SET style_parent_tree = '" . $this->db->sql_escape($parent_tree) . "'
WHERE style_parent_id = {$parent_id}";
- $db->sql_query($sql);
+ $this->db->sql_query($sql);
$updated = true;
}
return $updated;
}
-
+
/**
* Find all possible parent styles for style
*
@@ -838,9 +847,9 @@ class acp_styles
* @param int $id id of style
* @param int $parent current parent style id
* @param int $level current tree level
- * @returns array of style ids, names and levels
+ * @return array Style ids, names and levels
*/
- function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0)
+ protected function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0)
{
$results = array();
foreach ($styles as $style)
@@ -860,21 +869,19 @@ class acp_styles
}
return $results;
}
-
+
/**
* Show item in styles list
*
* @param array $style style row
* @param array $level style inheritance level
*/
- function list_style($style, $level)
+ protected function list_style(&$style, $level)
{
- global $template, $config, $db, $user, $phpbb_root_path, $phpEx;
-
// Mark row as shown
if (!empty($style['_shown'])) return;
$style['_shown'] = true;
-
+
// Generate template variables
$actions = array();
$row = array(
@@ -884,56 +891,56 @@ class acp_styles
'STYLE_PATH' => htmlspecialchars($style['style_path']),
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_ACTIVE' => $style['style_active'],
-
+
// Additional data
- 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $config['default_style']),
+ 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $this->default_style),
'USERS' => (isset($style['_users'])) ? $style['_users'] : '',
'LEVEL' => $level,
'PADDING' => (4 + 16 * $level),
'SHOW_COPYRIGHT' => ($style['style_id']) ? false : true,
'STYLE_PATH_FULL' => htmlspecialchars($this->styles_path_absolute . '/' . $style['style_path']) . '/',
-
+
// Comment to show below style
'COMMENT' => (isset($style['_note'])) ? $style['_note'] : '',
-
+
// The following variables should be used by hooks to add custom HTML code
'EXTRA' => '',
'EXTRA_OPTIONS' => ''
);
-
+
// Status specific data
if ($style['style_id'])
{
// Style is installed
-
+
// Details
$actions[] = array(
'U_ACTION' => $this->u_action . '&amp;action=details&amp;id=' . $style['style_id'],
- 'L_ACTION' => $user->lang['DETAILS']
+ 'L_ACTION' => $this->user->lang['DETAILS']
);
// Activate
$actions[] = array(
'U_ACTION' => $this->u_action . '&amp;action=' . ($style['style_active'] ? 'de' : '') . 'activate&amp;id=' . $style['style_id'],
- 'L_ACTION' => $user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE']
+ 'L_ACTION' => $this->user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE']
);
/* // Export
$actions[] = array(
'U_ACTION' => $this->u_action . '&amp;action=export&amp;id=' . $style['style_id'],
- 'L_ACTION' => $user->lang['EXPORT']
+ 'L_ACTION' => $this->user->lang['EXPORT']
); */
// Uninstall
$actions[] = array(
'U_ACTION' => $this->u_action . '&amp;action=uninstall&amp;id=' . $style['style_id'],
- 'L_ACTION' => $user->lang['STYLE_UNINSTALL']
+ 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL']
);
-
+
// Preview
$actions[] = array(
- 'U_ACTION' => append_sid("{$phpbb_root_path}index.$phpEx", 'style=' . $style['style_id']),
- 'L_ACTION' => $user->lang['PREVIEW']
+ 'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->phpEx, 'style=' . $style['style_id']),
+ 'L_ACTION' => $this->user->lang['PREVIEW']
);
}
else
@@ -942,27 +949,27 @@ class acp_styles
if (empty($style['_available']))
{
$actions[] = array(
- 'HTML' => $user->lang['CANNOT_BE_INSTALLED']
+ 'HTML' => $this->user->lang['CANNOT_BE_INSTALLED']
);
}
else
{
$actions[] = array(
'U_ACTION' => $this->u_action . '&amp;action=install&amp;dir=' . urlencode($style['style_path']),
- 'L_ACTION' => $user->lang['INSTALL_STYLE']
+ 'L_ACTION' => $this->user->lang['INSTALL_STYLE']
);
}
}
-
+
// todo: add hook
-
+
// Assign template variables
- $template->assign_block_vars('styles_list', $row);
+ $this->template->assign_block_vars('styles_list', $row);
foreach($actions as $action)
{
- $template->assign_block_vars('styles_list.actions', $action);
+ $this->template->assign_block_vars('styles_list.actions', $action);
}
-
+
// Increase counters
$counter = ($style['style_id']) ? ($style['style_active'] ? 'active' : 'inactive') : (empty($style['_available']) ? 'cannotinstall' : 'caninstall');
if (!isset($this->style_counters))
@@ -975,32 +982,31 @@ class acp_styles
'cannotinstall' => 0
);
}
- $this->style_counters[$counter] ++;
- $this->style_counters['total'] ++;
+ $this->style_counters[$counter]++;
+ $this->style_counters['total']++;
}
-
+
/**
* Show welcome message
*
* @param string $title main title
* @param string $description page description
*/
- function welcome_message($title, $description)
+ protected function welcome_message($title, $description)
{
- global $user, $template;
- $template->assign_vars(array(
- 'L_TITLE' => (isset($user->lang[$title])) ? $user->lang[$title] : $title,
- 'L_EXPLAIN' => (isset($user->lang[$description])) ? $user->lang[$description] : $description
+ $this->template->assign_vars(array(
+ 'L_TITLE' => $this->user->lang[$title],
+ 'L_EXPLAIN' => (isset($this->user->lang[$description])) ? $this->user->lang[$description] : ''
)
);
}
-
+
/**
* Find all directories that have styles
*
- * @returns array of directory names
+ * @return array Directory names
*/
- function find_style_dirs()
+ protected function find_style_dirs()
{
$styles = array();
@@ -1025,11 +1031,11 @@ class acp_styles
return $styles;
}
-
+
/**
* Sort styles
*/
- function sort_styles($style1, $style2)
+ public function sort_styles($style1, $style2)
{
if ($style1['style_active'] != $style2['style_active'])
{
@@ -1041,19 +1047,18 @@ class acp_styles
}
return strcasecmp(isset($style1['style_name']) ? $style1['style_name'] : $style1['name'], isset($style2['style_name']) ? $style2['style_name'] : $style2['name']);
}
-
+
/**
* Read style configuration file
*
* @param string $dir style directory
- * @returns array of style data
- * @returns false on error
+ * @return array|bool Style data, false on error
*/
- function read_style_cfg($dir)
+ protected function read_style_cfg($dir)
{
static $required = array('name', 'version', 'copyright');
$cfg = parse_cfg_file($this->styles_path . $dir . '/style.cfg');
-
+
// Check if it is a valid file
foreach ($required as $key)
{
@@ -1062,7 +1067,7 @@ class acp_styles
return false;
}
}
-
+
// Check data
if (!isset($cfg['parent']) || !is_string($cfg['parent']) || $cfg['parent'] == $cfg['name'])
{
@@ -1072,20 +1077,18 @@ class acp_styles
{
$cfg['template_bitfield'] = $this->default_bitfield();
}
-
+
return $cfg;
}
-
+
/**
* Install style
*
* @param $style style data
- * @returns int style id
+ * @return int Style id
*/
- function install_style($style)
+ protected function install_style($style)
{
- global $db;
-
// Generate row
$sql_ary = array();
foreach ($style as $key => $value)
@@ -1095,38 +1098,36 @@ class acp_styles
$sql_ary[$key] = $value;
}
}
-
+
// Add to database
- $db->sql_transaction('begin');
+ $this->db->sql_transaction('begin');
$sql = 'INSERT INTO ' . STYLES_TABLE . '
- ' . $db->sql_build_array('INSERT', $sql_ary);
- $db->sql_query($sql);
+ ' . $this->db->sql_build_array('INSERT', $sql_ary);
+ $this->db->sql_query($sql);
- $id = $db->sql_nextid();
+ $id = $this->db->sql_nextid();
- $db->sql_transaction('commit');
+ $this->db->sql_transaction('commit');
add_log('admin', 'LOG_STYLE_ADD', $sql_ary['style_name']);
-
+
return $id;
}
/**
* Lists all styles
*
- * @returns array of rows with styles data
+ * @return array Rows with styles data
*/
- function get_styles()
+ protected function get_styles()
{
- global $db;
-
- $sql = 'SELECT *
+ $sql = 'SELECT *
FROM ' . STYLES_TABLE;
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
- $rows = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
return $rows;
}
@@ -1134,64 +1135,60 @@ class acp_styles
/**
* Count users for each style
*
- * @returns array of styles in following format: [style_id] = number of users
+ * @return array Styles in following format: [style_id] = number of users
*/
- function get_users()
+ protected function get_users()
{
- global $db;
-
$sql = 'SELECT user_style, COUNT(user_style) AS style_count
FROM ' . USERS_TABLE . '
GROUP BY user_style';
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
- $style_count = array();
- while ($row = $db->sql_fetchrow($result))
+ $style_count = array();
+ while ($row = $this->db->sql_fetchrow($result))
{
$style_count[$row['user_style']] = $row['style_count'];
}
- $db->sql_freeresult($result);
-
+ $this->db->sql_freeresult($result);
+
return $style_count;
}
-
+
/**
* Uninstall style
*
* @param array $style Style data
- * @returns true on success, error message on error
+ * @return bool|string True on success, error message on error
*/
- function uninstall_style($style)
+ protected function uninstall_style($style)
{
- global $db, $user;
-
$id = $style['style_id'];
$path = $style['style_path'];
-
+
// Check if style has child styles
- $sql = 'SELECT style_id
+ $sql = 'SELECT style_id
FROM ' . STYLES_TABLE . '
- WHERE style_parent_id = ' . $id . " OR style_parent_tree = '" . $db->sql_escape($path) . "'";
- $result = $db->sql_query($sql);
-
- $conflict = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ WHERE style_parent_id = ' . (int) $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'";
+ $result = $this->db->sql_query($sql);
+
+ $conflict = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
if ($conflict !== false)
{
- return sprintf($user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']);
+ return sprintf($this->user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']);
}
-
+
// Change default style for users
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = 0
WHERE user_style = ' . $id;
- $db->sql_query($sql);
-
+ $this->db->sql_query($sql);
+
// Uninstall style
$sql = 'DELETE FROM ' . STYLES_TABLE . '
WHERE style_id = ' . $id;
- $db->sql_query($sql);
+ $this->db->sql_query($sql);
return true;
}
@@ -1200,13 +1197,13 @@ class acp_styles
*
* @param string $path Style directory
* @param string $dir Directory to remove inside style's directory
- * @returns true on success, false on error
+ * @return bool True on success, false on error
*/
- function delete_style_files($path, $dir = '')
+ protected function delete_style_files($path, $dir = '')
{
$dirname = $this->styles_path . $path . $dir;
$result = true;
-
+
$dp = @opendir($dirname);
if ($dp)
@@ -1239,24 +1236,22 @@ class acp_styles
{
return false;
}
-
+
return $result;
}
-
+
/**
* Get list of items from posted data
*
* @param string $name Variable name
- * @param $default Default value for array: string or number
+ * @param string|int $default Default value for array
* @param bool $error If true, error will be triggered if list is empty
- * @returns array of items
+ * @return array Items
*/
- function request_vars($name, $default, $error = false)
+ protected function request_vars($name, $default, $error = false)
{
- global $request, $user;
-
- $item = $request->variable($name, $default);
- $items = $request->variable($name . 's', array($default));
+ $item = $this->request->variable($name, $default);
+ $items = $this->request->variable($name . 's', array($default));
if (count($items) == 1 && $items[0] == $default)
{
@@ -1267,28 +1262,30 @@ class acp_styles
{
$items[] = $item;
}
-
+
if ($error && !count($items))
{
- trigger_error($user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
return $items;
}
/**
- * Generates hardcoded bitfield
+ * Generates default bitfield
+ *
+ * This bitfield decides which bbcodes are defined in a template.
*
- * @returns bitfield string
+ * @return string Bitfield
*/
- function default_bitfield()
+ protected function default_bitfield()
{
static $value;
if (isset($value))
{
return $value;
}
-
+
// Hardcoded template bitfield to add for new templates
$bitfield = new bitfield();
$bitfield->set(0);
diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php
index 62fb90d3c5..d57b333c69 100644
--- a/phpBB/includes/captcha/captcha_factory.php
+++ b/phpBB/includes/captcha/captcha_factory.php
@@ -25,7 +25,7 @@ class phpbb_captcha_factory
/**
* return an instance of class $name in file $name_plugin.php
*/
- function get_instance($name)
+ public static function get_instance($name)
{
global $phpbb_root_path, $phpEx;
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
index a63b0e448f..6c1f3bf00b 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
@@ -49,7 +49,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
}
}
- function get_instance()
+ public static function get_instance()
{
$instance = new phpbb_captcha_gd();
return $instance;
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
index f523cae191..a5588178bb 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
@@ -39,7 +39,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha
}
}
- function get_instance()
+ public static function get_instance()
{
return new phpbb_captcha_gd_wave();
}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php
index 4a0418146d..96f13fbe1b 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php
@@ -39,7 +39,7 @@ class phpbb_captcha_nogd extends phpbb_default_captcha
}
}
- function get_instance()
+ public static function get_instance()
{
$instance = new phpbb_captcha_nogd();
return $instance;
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index e12ad00d25..99813189d7 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -98,7 +98,7 @@ class phpbb_captcha_qa
/**
* API function
*/
- function get_instance()
+ public static function get_instance()
{
$instance = new phpbb_captcha_qa();
diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
index 0ea8b9c6e7..70c24a8c30 100644
--- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
@@ -54,7 +54,7 @@ class phpbb_recaptcha extends phpbb_default_captcha
$this->response = request_var('recaptcha_response_field', '');
}
- function get_instance()
+ public static function get_instance()
{
$instance = new phpbb_recaptcha();
return $instance;
diff --git a/phpBB/includes/extension/finder.php b/phpBB/includes/extension/finder.php
index 23b9f1c658..87ca40917d 100644
--- a/phpBB/includes/extension/finder.php
+++ b/phpBB/includes/extension/finder.php
@@ -270,11 +270,12 @@ class phpbb_extension_finder
* Finds all directories matching the configured options
*
* @param bool $cache Whether the result should be cached
+ * @param bool $extension_keys Whether the result should have extension name as array key
* @return array An array of paths to found directories
*/
- public function get_directories($cache = true)
+ public function get_directories($cache = true, $extension_keys = false)
{
- return $this->find_with_root_path($cache, true);
+ return $this->find_with_root_path($cache, true, $extension_keys);
}
/**
@@ -294,16 +295,25 @@ class phpbb_extension_finder
* @param bool $cache Whether the result should be cached
* @param bool $is_dir Directories will be returned when true, only files
* otherwise
+ * @param bool $extension_keys If true, result will be associative array
+ * with extension name as key
* @return array An array of paths to found items
*/
- protected function find_with_root_path($cache = true, $is_dir = false)
+ protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false)
{
$items = $this->find($cache, $is_dir);
$result = array();
foreach ($items as $item => $ext_name)
{
- $result[] = $this->phpbb_root_path . $item;
+ if ($extension_keys)
+ {
+ $result[$ext_name] = $this->phpbb_root_path . $item;
+ }
+ else
+ {
+ $result[] = $this->phpbb_root_path . $item;
+ }
}
return $result;
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 74db8cb8fd..9a6af29d69 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4770,7 +4770,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'T_ASSETS_PATH' => "{$web_path}assets",
'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme',
'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
- 'T_SUPER_TEMPLATE_PATH' => ($user->theme['style_parent_id']) ? "{$web_path}styles/" . rawurlencode($user->theme['style_parent_tree']) . '/template' : "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
+ 'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
'T_IMAGES_PATH' => "{$web_path}images/",
'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/",
'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/",
@@ -4860,6 +4860,7 @@ function page_footer($run_cron = true)
$template->assign_vars(array(
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
+ 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group'),
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '')
);
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 03dec1787a..dc61859363 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -131,6 +131,7 @@ function adm_page_footer($copyright_html = true)
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html,
+ 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group'),
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js",
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
'VERSION' => $config['version'])
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index f2faf20f43..6b2ee98d7a 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -739,7 +739,7 @@ function smiley_text($text, $force_option = false)
else
{
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
- return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
+ return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
}
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index b3816baedd..f77f54679f 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -496,7 +496,14 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
{
if ($free_space <= $file->get('filesize'))
{
- $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
+ if ($auth->acl_get('a_'))
+ {
+ $filedata['error'][] = $user->lang['ATTACH_DISK_FULL'];
+ }
+ else
+ {
+ $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
+ }
$filedata['post_attach'] = false;
$file->remove();
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 18452c27e9..5b05c3a78d 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1948,6 +1948,27 @@ function validate_jabber($jid)
}
/**
+* Verifies whether a style ID corresponds to an active style.
+*
+* @param int $style_id The style_id of a style which should be checked if activated or not.
+* @return boolean
+*/
+function phpbb_style_is_active($style_id)
+{
+ global $db;
+
+ $sql = 'SELECT style_active
+ FROM ' . STYLES_TABLE . '
+ WHERE style_id = '. (int) $style_id;
+ $result = $db->sql_query($sql);
+
+ $style_is_active = (bool) $db->sql_fetchfield('style_active');
+ $db->sql_freeresult($result);
+
+ return $style_is_active;
+}
+
+/**
* Remove avatar
*/
function avatar_delete($mode, $row, $clean_db = false)
diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/includes/style/extension_path_provider.php
index 1fb6580ce1..4eac300424 100644
--- a/phpBB/includes/style/extension_path_provider.php
+++ b/phpBB/includes/style/extension_path_provider.php
@@ -82,22 +82,26 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple
$directories = array();
$finder = $this->extension_manager->get_finder();
- foreach ($this->base_path_provider as $path)
+ foreach ($this->base_path_provider as $key => $paths)
{
- if ($path && !phpbb_is_absolute($path))
+ if ($key == 'style')
{
- $directories = array_merge($directories, $finder
- ->directory('/' . $this->ext_dir_prefix . $path)
- ->get_directories()
- );
+ foreach ($paths as $path)
+ {
+ $directories['style'][] = $path;
+ if ($path && !phpbb_is_absolute($path))
+ {
+ $result = $finder->directory('/' . $this->ext_dir_prefix . $path)
+ ->get_directories(true, true);
+ foreach ($result as $ext => $ext_path)
+ {
+ $directories[$ext][] = $ext_path;
+ }
+ }
+ }
}
}
- foreach ($this->base_path_provider as $path)
- {
- $directories[] = $path;
- }
-
return $directories;
}
@@ -112,14 +116,4 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple
$this->base_path_provider->set_styles($styles);
$this->items = null;
}
-
- /**
- * Retrieves the path to the main style passed into set_styles()
- *
- * @return string Main style path
- */
- public function get_main_style_path()
- {
- return $this->base_path_provider->get_main_style_path();
- }
}
diff --git a/phpBB/includes/style/path_provider.php b/phpBB/includes/style/path_provider.php
index c229af92ba..731d682e88 100644
--- a/phpBB/includes/style/path_provider.php
+++ b/phpBB/includes/style/path_provider.php
@@ -24,7 +24,6 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface
{
- protected $main_style_name = '';
protected $paths = array();
/**
@@ -41,25 +40,14 @@ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_p
* Overwrites the current style paths
*
* The first element of the passed styles map, is considered the main
- * style and can be retrieved through get_main_style_path().
+ * style.
*
* @param array $styles An array of style paths. The first element is the main style.
* @return null
*/
public function set_styles(array $styles)
{
- $this->paths = $styles;
- $this->main_style_path = $this->paths[0];
- }
-
- /**
- * Retrieves the path to the main style passed into set_styles()
- *
- * @return string Main style path
- */
- public function get_main_style_path()
- {
- return $this->main_style_path;
+ $this->paths = array('style' => $styles);
}
/**
diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/includes/style/path_provider_interface.php
index 7ae94e17f4..1a6153a4d3 100644
--- a/phpBB/includes/style/path_provider_interface.php
+++ b/phpBB/includes/style/path_provider_interface.php
@@ -39,11 +39,4 @@ interface phpbb_style_path_provider_interface extends Traversable
* @return null
*/
public function set_styles(array $styles);
-
- /**
- * Retrieves the path to the main style passed into set_styles()
- *
- * @return string Main style path
- */
- public function get_main_style_path();
}
diff --git a/phpBB/includes/style/resource_locator.php b/phpBB/includes/style/resource_locator.php
index af261534c3..3e6dd5d6aa 100644
--- a/phpBB/includes/style/resource_locator.php
+++ b/phpBB/includes/style/resource_locator.php
@@ -39,12 +39,6 @@ class phpbb_style_resource_locator
private $roots = array();
/**
- * Index of the main style in the roots array.
- * @var int
- */
- private $main_root_id = 0;
-
- /**
* Location of templates directory within style directories.
* Must have trailing slash. Empty if templates are stored in root
* style directory, such as admin control panel templates.
@@ -70,17 +64,6 @@ class phpbb_style_resource_locator
private $filenames = array();
/**
- * Set main style location (must have been added through set_paths first).
- *
- * @param string $style_path Path to style directory
- * @return null
- */
- public function set_main_style($style_path)
- {
- $this->main_root_id = array_search($style_path, $this->roots, true);
- }
-
- /**
* Sets the list of style paths
*
* These paths will be searched for style files in the provided order.
@@ -95,16 +78,18 @@ class phpbb_style_resource_locator
$this->roots = array();
$this->files = array();
$this->filenames = array();
- $this->main_root_id = 0;
- foreach ($style_paths as $path)
+ foreach ($style_paths as $key => $paths)
{
- // Make sure $path has no ending slash
- if (substr($path, -1) === '/')
+ foreach ($paths as $path)
{
- $path = substr($path, 0, -1);
+ // Make sure $path has no ending slash
+ if (substr($path, -1) === '/')
+ {
+ $path = substr($path, 0, -1);
+ }
+ $this->roots[$key][] = $path;
}
- $this->roots[] = $path;
}
}
@@ -125,9 +110,12 @@ class phpbb_style_resource_locator
$this->filename[$handle] = $filename;
- foreach ($this->roots as $root_index => $root)
+ foreach ($this->roots as $root_key => $root_paths)
{
- $this->files[$root_index][$handle] = $root . '/' . $this->template_path . $filename;
+ foreach ($root_paths as $root_index => $root)
+ {
+ $this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename;
+ }
}
}
}
@@ -174,12 +162,12 @@ class phpbb_style_resource_locator
public function get_virtual_source_file_for_handle($handle)
{
// If we don't have a file assigned to this handle, die.
- if (!isset($this->files[$this->main_root_id][$handle]))
+ if (!isset($this->files['style'][0][$handle]))
{
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
}
- $source_file = $this->files[$this->main_root_id][$handle];
+ $source_file = $this->files['style'][0][$handle];
return $source_file;
}
@@ -197,31 +185,107 @@ class phpbb_style_resource_locator
* handle to a path without any filesystem or styles tree checks.
*
* @param string $handle Template handle (i.e. "friendly" template name)
+ * @param bool $find_all If true, each root path will be checked and function
+ * will return array of files instead of string and will not
+ * trigger a error if template does not exist
* @return string Source file path
*/
- public function get_source_file_for_handle($handle)
+ public function get_source_file_for_handle($handle, $find_all = false)
{
// If we don't have a file assigned to this handle, die.
- if (!isset($this->files[$this->main_root_id][$handle]))
+ if (!isset($this->files['style'][0][$handle]))
{
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
}
// locate a source file that exists
- $source_file = $this->files[0][$handle];
+ $source_file = $this->files['style'][0][$handle];
$tried = $source_file;
- for ($i = 1, $n = count($this->roots); $i < $n && !file_exists($source_file); $i++)
+ $found = false;
+ $found_all = array();
+ foreach ($this->roots as $root_key => $root_paths)
{
- $source_file = $this->files[$i][$handle];
- $tried .= ', ' . $source_file;
+ foreach ($root_paths as $root_index => $root)
+ {
+ $source_file = $this->files[$root_key][$root_index][$handle];
+ $tried .= ', ' . $source_file;
+ if (file_exists($source_file))
+ {
+ $found = true;
+ break;
+ }
+ }
+ if ($found)
+ {
+ if ($find_all)
+ {
+ $found_all[] = $source_file;
+ $found = false;
+ }
+ else
+ {
+ break;
+ }
+ }
}
// search failed
- if (!file_exists($source_file))
+ if (!$found && !$find_all)
{
trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR);
}
- return $source_file;
+ return ($find_all) ? $found_all : $source_file;
+ }
+
+ /**
+ * Locates source file path, accounting for styles tree and verifying that
+ * the path exists.
+ *
+ * Unlike previous functions, this function works without template handle
+ * and it can search for more than one file. If more than one file name is
+ * specified, it will return location of file that it finds first.
+ *
+ * @param array $files List of files to locate.
+ * @param bool $return_default Determines what to return if file does not
+ * exist. If true, function will return location where file is
+ * supposed to be. If false, function will return false.
+ * @param bool $return_full_path If true, function will return full path
+ * to file. If false, function will return file name. This
+ * parameter can be used to check which one of set of files
+ * is available.
+ * @return string or boolean Source file path if file exists or $return_default is
+ * true. False if file does not exist and $return_default is false
+ */
+ public function get_first_file_location($files, $return_default = false, $return_full_path = true)
+ {
+ // set default value
+ $default_result = false;
+
+ // check all available paths
+ foreach ($this->roots as $root_paths)
+ {
+ foreach ($root_paths as $path)
+ {
+ // check all files
+ foreach ($files as $filename)
+ {
+ $source_file = $path . '/' . $filename;
+ if (file_exists($source_file))
+ {
+ return ($return_full_path) ? $source_file : $filename;
+ }
+
+ // assign first file as result if $return_default is true
+ if ($return_default && $default_result === false)
+ {
+ $default_result = $source_file;
+ }
+ }
+ }
+ }
+
+ // search failed
+ return $default_result;
}
}
diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php
index 539a2642ee..5ac61c9f10 100644
--- a/phpBB/includes/style/style.php
+++ b/phpBB/includes/style/style.php
@@ -92,6 +92,9 @@ class phpbb_style
$paths[] = $this->get_style_path($dir);
}
+ // Add 'all' path, used as last fallback path by hooks and extensions
+ $paths[] = $this->get_style_path('all');
+
return $this->set_custom_style($style_name, $paths);
}
@@ -113,7 +116,6 @@ class phpbb_style
$this->provider->set_styles($paths);
$this->locator->set_paths($this->provider);
- $this->locator->set_main_style($this->provider->get_main_style_path());
$this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_';
@@ -148,4 +150,32 @@ class phpbb_style
{
$this->provider->set_ext_dir_prefix($ext_dir_prefix);
}
+
+ /**
+ * Locates source file path, accounting for styles tree and verifying that
+ * the path exists.
+ *
+ * @param string or array $files List of files to locate. If there is only
+ * one file, $files can be a string to make code easier to read.
+ * @param bool $return_default Determines what to return if file does not
+ * exist. If true, function will return location where file is
+ * supposed to be. If false, function will return false.
+ * @param bool $return_full_path If true, function will return full path
+ * to file. If false, function will return file name. This
+ * parameter can be used to check which one of set of files
+ * is available.
+ * @return string or boolean Source file path if file exists or $return_default is
+ * true. False if file does not exist and $return_default is false
+ */
+ public function locate($files, $return_default = false, $return_full_path = true)
+ {
+ // convert string to array
+ if (is_string($files))
+ {
+ $files = array($files);
+ }
+
+ // use resource locator to find files
+ return $this->locator->get_first_file_location($files, $return_default, $return_full_path);
+ }
}
diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php
index 21a2e821dd..3f15355f7a 100644
--- a/phpBB/includes/style/template.php
+++ b/phpBB/includes/style/template.php
@@ -288,7 +288,7 @@ class phpbb_style_template
return new phpbb_style_template_renderer_include($output_file, $this);
}
- $compile = new phpbb_style_template_compile($this->config['tpl_allow_php']);
+ $compile = new phpbb_style_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path);
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
{
@@ -456,4 +456,59 @@ class phpbb_style_template
}
include($file);
}
+
+ /**
+ * Locates source template path, accounting for styles tree and verifying that
+ * the path exists.
+ *
+ * @param string or array $files List of templates to locate. If there is only
+ * one template, $files can be a string to make code easier to read.
+ * @param bool $return_default Determines what to return if template does not
+ * exist. If true, function will return location where template is
+ * supposed to be. If false, function will return false.
+ * @param bool $return_full_path If true, function will return full path
+ * to template. If false, function will return template file name.
+ * This parameter can be used to check which one of set of template
+ * files is available.
+ * @return string or boolean Source template path if template exists or $return_default is
+ * true. False if template does not exist and $return_default is false
+ */
+ public function locate($files, $return_default = false, $return_full_path = true)
+ {
+ // add tempalte path prefix
+ $templates = array();
+ if (is_string($files))
+ {
+ $templates[] = $this->template_path . $files;
+ }
+ else
+ {
+ foreach ($files as $file)
+ {
+ $templates[] = $this->template_path . $file;
+ }
+ }
+
+ // use resource locator to find files
+ return $this->locator->get_first_file_location($templates, $return_default, $return_full_path);
+ }
+
+ /**
+ * Include JS file
+ *
+ * @param string $file file name
+ * @param bool $locate True if file needs to be located
+ */
+ public function _js_include($file, $locate = false)
+ {
+ // Locate file
+ if ($locate)
+ {
+ $file = $this->locator->get_first_file_location(array($file), true, true);
+ }
+
+ // Add HTML code
+ $code = '<script src="' . htmlspecialchars($file) . '"></script>';
+ $this->context->append_var('SCRIPTS', $code);
+ }
}
diff --git a/phpBB/includes/style/template_compile.php b/phpBB/includes/style/template_compile.php
index 3ef3fffc00..fa0928f424 100644
--- a/phpBB/includes/style/template_compile.php
+++ b/phpBB/includes/style/template_compile.php
@@ -26,20 +26,26 @@ stream_filter_register('phpbb_template', 'phpbb_style_template_filter');
class phpbb_style_template_compile
{
/**
- * Whether <!-- PHP --> tags are allowed
+ * Array of parameters to forward to template filter
*
- * @var bool
+ * @var array
*/
- private $allow_php;
+ private $filter_params;
/**
* Constructor.
*
* @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
+ * @param phpbb_style_resource_locator $locator Resource locator
+ * @param string $phpbb_root_path Path to phpBB root directory
*/
- public function __construct($allow_php)
+ public function __construct($allow_php, $locator, $phpbb_root_path)
{
- $this->allow_php = $allow_php;
+ $this->filter_params = array(
+ 'allow_php' => $allow_php,
+ 'locator' => $locator,
+ 'phpbb_root_path' => $phpbb_root_path
+ );
}
/**
@@ -116,7 +122,7 @@ class phpbb_style_template_compile
*/
private function compile_stream_to_stream($source_stream, $dest_stream)
{
- stream_filter_append($source_stream, 'phpbb_template', null, array('allow_php' => $this->allow_php));
+ stream_filter_append($source_stream, 'phpbb_template', null, $this->filter_params);
stream_copy_to_stream($source_stream, $dest_stream);
}
}
diff --git a/phpBB/includes/style/template_filter.php b/phpBB/includes/style/template_filter.php
index 04fe85e07f..d62ad0ba1e 100644
--- a/phpBB/includes/style/template_filter.php
+++ b/phpBB/includes/style/template_filter.php
@@ -76,6 +76,18 @@ class phpbb_style_template_filter extends php_user_filter
private $allow_php;
/**
+ * Resource locator.
+ *
+ * @var phpbb_template_locator
+ */
+ private $locator;
+
+ /**
+ * @var string phpBB root path
+ */
+ private $phpbb_root_path;
+
+ /**
* Stream filter
*
* Is invoked for evey chunk of the stream, allowing us
@@ -126,14 +138,16 @@ class phpbb_style_template_filter extends php_user_filter
/**
* Initializer, called on creation.
*
- * Get the allow_php option from params, which is passed
- * to stream_filter_append.
+ * Get the allow_php option, root directory and locator from params,
+ * which are passed to stream_filter_append.
*/
public function onCreate()
{
$this->chunk = '';
$this->in_php = false;
$this->allow_php = $this->params['allow_php'];
+ $this->locator = $this->params['locator'];
+ $this->phpbb_root_path = $this->params['phpbb_root_path'];
return true;
}
@@ -281,6 +295,10 @@ class phpbb_style_template_filter extends php_user_filter
return ($this->allow_php) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
break;
+ case 'INCLUDEJS':
+ return '<?php ' . $this->compile_tag_include_js($matches[2]) . ' ?>';
+ break;
+
case 'PHP':
if ($this->allow_php)
{
@@ -857,6 +875,45 @@ class phpbb_style_template_filter extends php_user_filter
}
/**
+ * Compile INCLUDEJS tag
+ *
+ * @param string $tag_args Expression given with INCLUDEJS in source template
+ * @return string compiled template code
+ */
+ private function compile_tag_include_js($tag_args)
+ {
+ // Process dynamic includes
+ if ($tag_args[0] == '{')
+ {
+ $var = $this->get_varref($tag_args, $is_expr);
+ if (!$is_expr)
+ {
+ return " \$_template->_js_include($var, true);";
+ }
+ return '';
+ }
+
+ // Locate file
+ $filename = $this->locator->get_first_file_location(array($tag_args), false, true);
+
+ if ($filename === false)
+ {
+ // File does not exist, find it during run time
+ return ' $_template->_js_include(\'' . addslashes($tag_args) . '\', true); ';
+ }
+
+ if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path)
+ {
+ // Absolute path, include as is
+ return ' $_template->_js_include(\'' . addslashes($filename) . '\', false); ';
+ }
+
+ // Relative path, remove root path from it
+ $filename = substr($filename, strlen($this->phpbb_root_path));
+ return ' global $phpbb_root_path; $_template->_js_include($phpbb_root_path . \'' . addslashes($filename) . '\', false); ';
+ }
+
+ /**
* Generates a reference to the given variable inside the given (possibly nested)
* block namespace. This is a string of the form:
* ' . $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 11f2d231fe..0c9f20f266 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -60,7 +60,14 @@ class ucp_prefs
if ($submit)
{
- $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
+ if ($config['override_user_style'])
+ {
+ $data['style'] = (int) $config['default_style'];
+ }
+ else if (!phpbb_style_is_active($data['style']))
+ {
+ $data['style'] = (int) $user->data['user_style'];
+ }
$error = validate_data($data, array(
'dateformat' => array('string', false, 1, 30),
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index a84136388c..be39b12d12 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1063,6 +1063,8 @@ function database_update_info()
'3.0.10-RC2' => array(),
// No changes from 3.0.10-RC3 to 3.0.10
'3.0.10-RC3' => array(),
+ // No changes from 3.0.10 to 3.0.11-RC1
+ '3.0.10' => array(),
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */
@@ -2147,6 +2149,32 @@ function change_database_data(&$no_updates, $version)
case '3.0.10-RC3':
break;
+ // Changes from 3.0.10 to 3.0.11-RC1
+ case '3.0.10':
+ // Updates users having current style a deactivated one
+ $sql = 'SELECT style_id
+ FROM ' . STYLES_TABLE . '
+ WHERE style_active = 0';
+ $result = $db->sql_query($sql);
+
+ $deactivated_style_ids = array();
+ while ($style_id = $db->sql_fetchfield('style_id', false, $result))
+ {
+ $deactivated_style_ids[] = (int) $style_id;
+ }
+ $db->sql_freeresult($result);
+
+ if (!empty($deactivated_style_ids))
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_style = ' . (int) $config['default_style'] .'
+ WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids);
+ _sql($sql, $errored, $error_ary);
+ }
+
+ $no_updates = false;
+ break;
+
// Changes from 3.1.0-dev to 3.1.0-A1
case '3.1.0-dev':
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 361376763d..7558fde944 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1804,6 +1804,9 @@ class install_install extends module
$this->page_title = $lang['STAGE_FINAL'];
+ // Obtain any submitted data
+ $data = $this->get_submitted_data();
+
// We need to fill the config to let internal functions correctly work
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
set_config(null, null, null, $config);
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index b92b915623..12f8edad9e 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -207,7 +207,7 @@ $lang = array_merge($lang, array(
'FORM_INVALID' => 'The submitted form was invalid. Try submitting again.',
'FORUM' => 'Forum',
'FORUMS' => 'Forums',
- 'FORUMS_MARKED' => 'The selected forums have been marked read.',
+ 'FORUMS_MARKED' => 'Forums have been marked read.',
'FORUM_CAT' => 'Forum category',
'FORUM_INDEX' => 'Board index',
'FORUM_LINK' => 'Forum link',
@@ -482,6 +482,7 @@ $lang = array_merge($lang, array(
'POST_TIME' => 'Post time',
'POST_TOPIC' => 'Post a new topic',
'POST_UNAPPROVED' => 'Post awaiting approval:',
+ 'POWERED_BY' => 'Powered by %s',
'PREVIEW' => 'Preview',
'PREVIOUS' => 'Previous', // Used in pagination
'PREVIOUS_STEP' => 'Previous',
diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php
index fa536e5b91..b14f155f3a 100644
--- a/phpBB/language/en/help_faq.php
+++ b/phpBB/language/en/help_faq.php
@@ -332,7 +332,7 @@ $help = array(
),
array(
0 => 'Why isn’t X feature available?',
- 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, please visit the phpbb.com website and see what phpBB Group have to say. Please do not post feature requests to the board at phpbb.com, the group uses SourceForge to handle tasking of new features. Please read through the forums and see what, if any, our position may already be for a feature and then follow the procedure given there.'
+ 1 => 'This software was written by and licensed through phpBB Group. If you believe a feature needs to be added, or you want to report a bug, please visit the phpBB <a href="http://area51.phpbb.com/">Area51</a> website, where you will find resources to do so.'
),
array(
0 => 'Who do I contact about abusive and/or legal matters related to this board?',
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index bd25d403ab..3ee619ea16 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -389,7 +389,7 @@ $lang = array_merge($lang, array(
'WARNING_PM_BODY' => 'The following is a warning which has been issued to you by an administrator or moderator of this site.[quote]%s[/quote]',
'WARNING_PM_SUBJECT' => 'Board warning issued',
'WARNING_POST_DEFAULT' => 'This is a warning regarding the following post made by you: %s .',
- 'WARNINGS_ZERO_TOTAL' => 'No warnings exist.',
+ 'NO_WARNINGS' => 'No warnings exist.',
'YOU_SELECTED_TOPIC' => 'You selected topic number %d: %s.',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 933287dde3..086bd6ffb0 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -41,6 +41,7 @@ $lang = array_merge($lang, array(
'ADD_POLL' => 'Poll creation',
'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank.',
'ALREADY_DELETED' => 'Sorry but this message is already deleted.',
+ 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment.',
'ATTACH_QUOTA_REACHED' => 'Sorry, the board attachment quota has been reached.',
'ATTACH_SIG' => 'Attach a signature (signatures can be altered via the UCP)',
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php
index 1460490672..184f88ed3c 100644
--- a/phpBB/language/en/viewtopic.php
+++ b/phpBB/language/en/viewtopic.php
@@ -62,7 +62,7 @@ $lang = array_merge($lang, array(
'FILE_NOT_FOUND_404' => 'The file <strong>%s</strong> does not exist.',
'FORK_TOPIC' => 'Copy topic',
- 'FULL_EDITOR' => 'Full Editor',
+ 'FULL_EDITOR' => 'Full Editor &amp; Preview',
'LINKAGE_FORBIDDEN' => 'You are not authorised to view, download or link from/to this site.',
'LOGIN_NOTIFY_TOPIC' => 'You have been notified about this topic, please login to view it.',
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 741ac2f430..ed87b6c448 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -61,11 +61,6 @@ $default_key = 'c';
$sort_key = request_var('sk', $default_key);
$sort_dir = request_var('sd', 'a');
-
-// Grab rank information for later
-$ranks = $cache->obtain_ranks();
-
-
// What do you want to do today? ... oops, I think that line is taken ...
switch ($mode)
{
@@ -1222,21 +1217,16 @@ switch ($mode)
// Misusing the avatar function for displaying group avatars...
$avatar_img = get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR');
+ // ... same for group rank
$rank_title = $rank_img = $rank_img_src = '';
if ($group_row['group_rank'])
{
- if (isset($ranks['special'][$group_row['group_rank']]))
+ get_user_rank($group_row['group_rank'], false, $rank_title, $rank_img, $rank_img_src);
+
+ if ($rank_img)
{
- $rank_title = $ranks['special'][$group_row['group_rank']]['rank_title'];
+ $rank_img .= '<br />';
}
- $rank_img = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? '<img src="' . $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] . '" alt="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" title="' . $ranks['special'][$group_row['group_rank']]['rank_title'] . '" /><br />' : '';
- $rank_img_src = (!empty($ranks['special'][$group_row['group_rank']]['rank_image'])) ? $config['ranks_path'] . '/' . $ranks['special'][$group_row['group_rank']]['rank_image'] : '';
- }
- else
- {
- $rank_title = '';
- $rank_img = '';
- $rank_img_src = '';
}
$template->assign_vars(array(
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 56fb7832f2..7f57f693af 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -38,7 +38,7 @@ $load = (isset($_POST['load'])) ? true : false;
$delete = (isset($_POST['delete'])) ? true : false;
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
-$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['full_editor']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false;
+$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview) ? true : false;
$mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', '');
$error = $post_data = array();
@@ -1198,8 +1198,8 @@ if (!sizeof($error) && $preview)
'PREVIEW_MESSAGE' => $preview_message,
'PREVIEW_SIGNATURE' => $preview_signature,
- 'S_DISPLAY_PREVIEW' => true)
- );
+ 'S_DISPLAY_PREVIEW' => !empty($preview_message),
+ ));
}
}
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index cc886c42b1..54f34e4204 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -66,6 +66,17 @@ $('[data-ajax]').each(function() {
});
+/**
+ * This simply appends #preview to the action of the
+ * QR action when you click the Full Editor & Preview button
+ */
+$('#qr_full_editor').click(function() {
+ $('#qr_postform').attr('action', function(i, val) {
+ return val + '#preview';
+ });
+});
+
+
/**
* This AJAXifies the quick-mod tools. The reason it cannot be a standard
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js
index 2c41b543b5..c16b0ef703 100644
--- a/phpBB/styles/prosilver/template/editor.js
+++ b/phpBB/styles/prosilver/template/editor.js
@@ -219,7 +219,7 @@ function addquote(post_id, username, l_wrote)
// Get text selection - not only the post content :(
// IE9 must use the document.selection method but has the *.getSelection so we just force no IE
- if (window.getSelection && !is_ie)
+ if (window.getSelection && !is_ie && !window.opera)
{
theSelection = window.getSelection().toString();
}
diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html
index ab0c83a56f..5f240b73fc 100644
--- a/phpBB/styles/prosilver/template/mcp_topic.html
+++ b/phpBB/styles/prosilver/template/mcp_topic.html
@@ -1,5 +1,6 @@
<!-- INCLUDE mcp_header.html -->
+<div class="tabs-container">
<h2><a href="{U_VIEW_TOPIC}">{L_TOPIC}: {TOPIC_TITLE}</a></h2>
<script type="text/javascript">
@@ -35,6 +36,7 @@ onload_functions.push('subPanels()');
</li>
</ul>
</div>
+</div>
<form id="mcp" method="post" action="{S_MCP_ACTION}">
diff --git a/phpBB/styles/prosilver/template/mcp_warn_front.html b/phpBB/styles/prosilver/template/mcp_warn_front.html
index 8f42e28cc0..2f7d939b16 100644
--- a/phpBB/styles/prosilver/template/mcp_warn_front.html
+++ b/phpBB/styles/prosilver/template/mcp_warn_front.html
@@ -55,7 +55,7 @@
</tbody>
</table>
<!-- ELSE -->
- <p><strong>{L_WARNINGS_ZERO_TOTAL}</strong></p>
+ <p><strong>{L_NO_WARNINGS}</strong></p>
<!-- ENDIF -->
<span class="corners-bottom"><span></span></span></div>
@@ -88,7 +88,7 @@
</tbody>
</table>
<!-- ELSE -->
- <p><strong>{L_WARNINGS_ZERO_TOTAL}</strong></p>
+ <p><strong>{L_NO_WARNINGS}</strong></p>
<!-- ENDIF -->
<span class="corners-bottom"><span></span></span></div>
diff --git a/phpBB/styles/prosilver/template/mcp_warn_list.html b/phpBB/styles/prosilver/template/mcp_warn_list.html
index d9c0bce088..5e43903f11 100644
--- a/phpBB/styles/prosilver/template/mcp_warn_list.html
+++ b/phpBB/styles/prosilver/template/mcp_warn_list.html
@@ -53,7 +53,7 @@
</li>
</ul>
<!-- ELSE -->
- <p><strong>{L_WARNINGS_ZERO_TOTAL}</strong></p>
+ <p><strong>{L_NO_WARNINGS}</strong></p>
<!-- ENDIF -->
<span class="corners-bottom"><span></span></span></div>
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index 1561bae26a..c84b327b71 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -19,7 +19,7 @@
<span class="corners-bottom"><span></span></span></div>
</div>
- <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ <div class="copyright">{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF -->
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
@@ -52,7 +52,8 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js"></script>
-<script type="text/javascript" src="{T_TEMPLATE_PATH}/ajax.js"></script>
+<!-- INCLUDEJS template/ajax.js -->
+{SCRIPTS}
</body>
</html>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 5e095d0a0d..72fc9c89ab 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -22,10 +22,6 @@
Based on style: prosilver (this is the default phpBB3 style)
Original author: Tom Beddard ( http://www.subBlue.com/ )
Modified by:
-
- NOTE: This page was generated by phpBB, the free open-source bulletin board package.
- The phpBB Group is not responsible for the content of this page and forum. For more information
- about phpBB please visit http://www.phpbb.com
-->
<script type="text/javascript">
diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html
index 4cd5eedd3e..a08b5dc3cc 100644
--- a/phpBB/styles/prosilver/template/quickreply_editor.html
+++ b/phpBB/styles/prosilver/template/quickreply_editor.html
@@ -1,4 +1,4 @@
-<form method="post" action="{U_QR_ACTION}">
+<form method="post" action="{U_QR_ACTION}" id="qr_postform">
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<h2>{L_QUICKREPLY}</h2>
@@ -14,8 +14,8 @@
<fieldset class="submit-buttons">
{S_FORM_TOKEN}
{QR_HIDDEN_FIELDS}
- <input type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" class="button1" />&nbsp;
- <input type="submit" accesskey="f" tabindex="7" name="full_editor" value="{L_FULL_EDITOR}" class="button2" data-ajax="false" />&nbsp;
+ <input type="submit" accesskey="f" tabindex="6" name="preview" value="{L_FULL_EDITOR}" class="button2" data-ajax="false" id="qr_full_editor" />&nbsp;
+ <input type="submit" accesskey="s" tabindex="7" name="post" value="{L_SUBMIT}" class="button1" />&nbsp;
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
diff --git a/phpBB/styles/prosilver/template/simple_footer.html b/phpBB/styles/prosilver/template/simple_footer.html
index 3458d02495..64dd2ff96b 100644
--- a/phpBB/styles/prosilver/template/simple_footer.html
+++ b/phpBB/styles/prosilver/template/simple_footer.html
@@ -1,6 +1,6 @@
</div>
- <div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ <div class="copyright">{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- IF DEBUG_OUTPUT --><br />{DEBUG_OUTPUT}<!-- ENDIF -->
</div>
@@ -8,6 +8,7 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
+{SCRIPTS}
</body>
</html>
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 31015b28f9..e95acf52b8 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -385,7 +385,7 @@ ul.rightside {
/* Table styles
----------------------------------------*/
table.table1 {
- /* See tweaks.css */
+ width: 100%;
}
#ucp-main table.table1 {
@@ -594,7 +594,7 @@ li.pagination {
border: 1px solid transparent;
position: fixed;
display: none;
- top: 100px;
+ top: 40%;
left: 35%;
width: 30%;
z-index: 50;
@@ -713,3 +713,7 @@ p.rules a {
.hidden {
display: none;
}
+
+.smilies {
+ vertical-align: text-bottom;
+}
diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css
index 74f11e47a6..6119691336 100644
--- a/phpBB/styles/prosilver/theme/cp.css
+++ b/phpBB/styles/prosilver/theme/cp.css
@@ -97,6 +97,22 @@ ul.cplist {
width: 100%;
}
+.tabs-container h2 {
+ float: left;
+ margin-bottom: 0px;
+}
+
+.tabs-container #minitabs {
+ float: right;
+ margin-top: 19px;
+}
+
+.tabs-container:after {
+ display: block;
+ clear: both;
+ content: '';
+}
+
/* CP tabbed menu
----------------------------------------*/
#tabs {
diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css
index 416c4a5510..40df61580e 100644
--- a/phpBB/styles/prosilver/theme/tweaks.css
+++ b/phpBB/styles/prosilver/theme/tweaks.css
@@ -4,10 +4,6 @@ These style definitions are IE 7 and 8 specific
tweaks required due to its poor CSS support.
-------------------------------------------------*/
-table.table1 {
- width: 100%;
-}
-
/* Align checkboxes/radio buttons nicely */
dd label input {
vertical-align: text-bottom;
@@ -28,4 +24,14 @@ dl.details dd {
/* Headerbar height fix for IE7 */
#site-description p {
*margin-bottom: 1.0em;
+}
+
+/* #minitabs fix for IE */
+.tabs-container {
+ zoom: 1;
+}
+
+#minitabs {
+ white-space: nowrap;
+ *min-width: 50%;
} \ No newline at end of file
diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js
index b47583ec75..151cf53ff1 100644
--- a/phpBB/styles/subsilver2/template/editor.js
+++ b/phpBB/styles/subsilver2/template/editor.js
@@ -221,7 +221,7 @@ function addquote(post_id, username, l_wrote)
// Get text selection - not only the post content :(
// IE9 must use the document.selection method but has the *.getSelection so we just force no IE
- if (window.getSelection && !is_ie)
+ if (window.getSelection && !is_ie && !window.opera)
{
theSelection = window.getSelection().toString();
}
diff --git a/phpBB/styles/subsilver2/template/mcp_warn_front.html b/phpBB/styles/subsilver2/template/mcp_warn_front.html
index 417355d537..020a79f419 100644
--- a/phpBB/styles/subsilver2/template/mcp_warn_front.html
+++ b/phpBB/styles/subsilver2/template/mcp_warn_front.html
@@ -38,7 +38,7 @@
</tr>
<!-- BEGINELSE -->
<tr>
- <td class="row1" colspan="4" align="center"><span class="gen">{L_WARNINGS_ZERO_TOTAL}</span></td>
+ <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td>
</tr>
<!-- END highest -->
</table>
@@ -64,7 +64,7 @@
</tr>
<!-- BEGINELSE -->
<tr>
- <td class="row1" colspan="4" align="center"><span class="gen">{L_WARNINGS_ZERO_TOTAL}</span></td>
+ <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td>
</tr>
<!-- END latest -->
</table>
diff --git a/phpBB/styles/subsilver2/template/mcp_warn_list.html b/phpBB/styles/subsilver2/template/mcp_warn_list.html
index 6ed0b68bd5..0b0cfa8a45 100644
--- a/phpBB/styles/subsilver2/template/mcp_warn_list.html
+++ b/phpBB/styles/subsilver2/template/mcp_warn_list.html
@@ -21,7 +21,7 @@
</tr>
<!-- BEGINELSE -->
<tr>
- <td class="row1" colspan="4" align="center"><span class="gen">{L_WARNINGS_ZERO_TOTAL}</span></td>
+ <td class="row1" colspan="4" align="center"><span class="gen">{L_NO_WARNINGS}</span></td>
</tr>
<!-- END user -->
<tr align="center">
diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html
index 9b0b95372e..4f686cf5e4 100644
--- a/phpBB/styles/subsilver2/template/overall_footer.html
+++ b/phpBB/styles/subsilver2/template/overall_footer.html
@@ -3,13 +3,14 @@
<div id="wrapfooter">
<!-- IF U_ACP --><span class="gensmall">[ <a href="{U_ACP}">{L_ACP}</a> ]</span><br /><br /><!-- ENDIF -->
- <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
+ <span class="copyright">{CREDIT_LINE}
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
<!-- IF DEBUG_OUTPUT --><br /><bdo dir="ltr">[ {DEBUG_OUTPUT} ]</bdo><!-- ENDIF --></span>
</div>
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
+{SCRIPTS}
</body>
</html>
diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html
index de5017280c..4c3f7a3d0b 100644
--- a/phpBB/styles/subsilver2/template/quickreply_editor.html
+++ b/phpBB/styles/subsilver2/template/quickreply_editor.html
@@ -14,8 +14,8 @@
</tr>
<tr>
<td class="cat" colspan="2" align="center">
- <input class="btnmain" type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" />&nbsp;
- <input class="btnlite" type="submit" accesskey="f" tabindex="7" name="full_editor" value="{L_FULL_EDITOR}" />
+ <input class="btnlite" type="submit" accesskey="f" tabindex="6" name="preview" value="{L_FULL_EDITOR}" />&nbsp;
+ <input class="btnmain" type="submit" accesskey="s" tabindex="7" name="post" value="{L_SUBMIT}" />
{S_FORM_TOKEN}
{QR_HIDDEN_FIELDS}
diff --git a/phpBB/styles/subsilver2/template/simple_footer.html b/phpBB/styles/subsilver2/template/simple_footer.html
index b51be3ac4c..771765ee12 100644
--- a/phpBB/styles/subsilver2/template/simple_footer.html
+++ b/phpBB/styles/subsilver2/template/simple_footer.html
@@ -2,11 +2,12 @@
</div>
<div id="wrapfooter">
- <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group</span>
+ <span class="copyright">{CREDIT_LINE}
</div>
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
+{SCRIPTS}
</body>
</html>
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index 21b12777dc..cc213f09bc 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -17,7 +17,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml');
}
- public static function return_on_error_select_data()
+ public function return_on_error_select_data()
{
return array(
array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))),
@@ -44,7 +44,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
- public static function fetchrow_data()
+ public function fetchrow_data()
{
return array(
array('', array(array('username_clean' => 'barfoo'),
@@ -95,7 +95,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
- public static function fetchfield_data()
+ public function fetchfield_data()
{
return array(
array('', array('barfoo', 'foobar', 'bertie')),
@@ -125,7 +125,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$this->assertEquals($expected, $ary);
}
- public static function query_limit_data()
+ public function query_limit_data()
{
return array(
array(0, 0, array(array('username_clean' => 'barfoo'),
@@ -166,7 +166,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$this->assertEquals($expected, $ary);
}
- public static function like_expression_data()
+ public function like_expression_data()
{
// * = any_char; # = one_char
return array(
@@ -203,7 +203,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
- public static function in_set_data()
+ public function in_set_data()
{
return array(
array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))),
@@ -277,7 +277,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
- public static function build_array_data()
+ public function build_array_data()
{
return array(
array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))),
diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php
index 596c50a220..987161a831 100644
--- a/tests/dbal/write_test.php
+++ b/tests/dbal/write_test.php
@@ -16,7 +16,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml');
}
- public static function build_array_insert_data()
+ public function build_array_insert_data()
{
return array(
array(array(
@@ -104,7 +104,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
- public static function update_data()
+ public function update_data()
{
return array(
array(
diff --git a/tests/group_positions/group_positions_test.php b/tests/group_positions/group_positions_test.php
index fd9f57e78f..c17e25511b 100644
--- a/tests/group_positions/group_positions_test.php
+++ b/tests/group_positions/group_positions_test.php
@@ -15,7 +15,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/group_positions.xml');
}
- public static function get_group_value_data()
+ public function get_group_value_data()
{
return array(
array('teampage', 1, 0),
@@ -38,7 +38,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $test_class->get_group_value($group_id));
}
- public static function get_group_count_data()
+ public function get_group_count_data()
{
return array(
array('teampage', 2),
@@ -59,7 +59,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $test_class->get_group_count());
}
- public static function add_group_data()
+ public function add_group_data()
{
return array(
array('teampage', 1, array(
@@ -93,7 +93,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
- public static function delete_group_data()
+ public function delete_group_data()
{
return array(
array('teampage', 1, false, array(
@@ -147,7 +147,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
- public static function move_up_data()
+ public function move_up_data()
{
return array(
array('teampage', 1, array(
@@ -186,7 +186,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
- public static function move_down_data()
+ public function move_down_data()
{
return array(
array('teampage', 1, array(
@@ -225,7 +225,7 @@ class phpbb_group_positions_test extends phpbb_database_test_case
$this->assertEquals($expected, $db->sql_fetchrowset($result));
}
- public static function move_data()
+ public function move_data()
{
return array(
array('teampage', 1, 1, array(
diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php
index 1fa0afae13..0e85d4694b 100644
--- a/tests/request/request_var_test.php
+++ b/tests/request/request_var_test.php
@@ -112,7 +112,7 @@ class phpbb_request_var_test extends phpbb_test_case
$this->assertEquals($expected, $result, 'Testing deep access to multidimensional input arrays: ' . $path);
}
- public static function deep_access()
+ public function deep_access()
{
return array(
// array(path, default, expected result)
@@ -123,7 +123,7 @@ class phpbb_request_var_test extends phpbb_test_case
);
}
- public static function request_variables()
+ public function request_variables()
{
return array(
// strings
diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php
index b4a475ffb3..d77cbbcaf3 100644
--- a/tests/security/extract_current_page_test.php
+++ b/tests/security/extract_current_page_test.php
@@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_security_extract_current_page_test extends phpbb_security_test_base
{
- public static function security_variables()
+ public function security_variables()
{
return array(
array('http://localhost/phpBB/index.php', 'mark=forums&x="><script>alert(/XSS/);</script>', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'),
diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php
index da318209e2..1325466137 100644
--- a/tests/security/redirect_test.php
+++ b/tests/security/redirect_test.php
@@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_security_redirect_test extends phpbb_security_test_base
{
- public static function provider()
+ public function provider()
{
// array(Input -> redirect(), expected triggered error (else false), expected returned result url (else false))
return array(
diff --git a/tests/template/template_compile_test.php b/tests/template/template_compile_test.php
index fb158cabd5..e2264fb1b7 100644
--- a/tests/template/template_compile_test.php
+++ b/tests/template/template_compile_test.php
@@ -16,7 +16,7 @@ class phpbb_template_template_compile_test extends phpbb_test_case
protected function setUp()
{
- $this->template_compile = new phpbb_style_template_compile(false);
+ $this->template_compile = new phpbb_style_template_compile(false, null, '');
$this->template_path = dirname(__FILE__) . '/templates';
}
diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php
new file mode 100644
index 0000000000..fa23837553
--- /dev/null
+++ b/tests/template/template_includejs_test.php
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/template_test_case_with_tree.php';
+
+class phpbb_template_template_includejs_test extends phpbb_template_template_test_case_with_tree
+{
+ public function test_includejs_compilation()
+ {
+ // Reset the engine state
+ $this->setup_engine();
+
+ // Prepare correct result
+ $dir = dirname(__FILE__);
+ $scripts = array(
+ '<script src="' . $dir . '/templates/parent_and_child.html"></script>',
+ '<script src="' . $dir . '/parent_templates/parent_only.html"></script>',
+ '<script src="' . $dir . '/templates/child_only.html"></script>'
+ );
+
+ // Run test
+ $cache_file = $this->template->cachepath . 'includejs.html.php';
+ $this->run_template('includejs.html', array('PARENT' => 'parent_only.html'), array(), array(), implode('', $scripts), $cache_file);
+ }
+}
diff --git a/tests/template/template_inheritance_test.php b/tests/template/template_inheritance_test.php
index 7348da9a4a..febfed9ef0 100644
--- a/tests/template/template_inheritance_test.php
+++ b/tests/template/template_inheritance_test.php
@@ -7,14 +7,14 @@
*
*/
-require_once dirname(__FILE__) . '/template_test_case.php';
+require_once dirname(__FILE__) . '/template_test_case_with_tree.php';
-class phpbb_template_template_inheritance_test extends phpbb_template_template_test_case
+class phpbb_template_template_inheritance_test extends phpbb_template_template_test_case_with_tree
{
/**
* @todo put test data into templates/xyz.test
*/
- public static function template_data()
+ public function template_data()
{
return array(
// First element of the array is test name - keep them distinct
@@ -61,20 +61,4 @@ class phpbb_template_template_inheritance_test extends phpbb_template_template_t
$this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file);
}
-
- protected function setup_engine(array $new_config = array())
- {
- global $phpbb_root_path, $phpEx, $user;
-
- $defaults = $this->config_defaults();
- $config = new phpbb_config(array_merge($defaults, $new_config));
-
- $this->template_path = dirname(__FILE__) . '/templates';
- $this->parent_template_path = dirname(__FILE__) . '/parent_templates';
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->style_provider = new phpbb_style_path_provider();
- $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider);
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
- $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), '');
- }
}
diff --git a/tests/template/template_locate_test.php b/tests/template/template_locate_test.php
new file mode 100644
index 0000000000..d6e2e82a47
--- /dev/null
+++ b/tests/template/template_locate_test.php
@@ -0,0 +1,68 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/template_test_case_with_tree.php';
+
+class phpbb_template_template_locate_test extends phpbb_template_template_test_case_with_tree
+{
+ public function template_data()
+ {
+ return array(
+ // First element of the array is test name - keep them distinct
+ array(
+ 'simple inheritance - only parent template exists',
+ dirname(__FILE__) . '/parent_templates/parent_only.html',
+ 'parent_only.html',
+ false,
+ true,
+ ),
+ array(
+ 'simple inheritance - only child template exists',
+ dirname(__FILE__) . '/templates/child_only.html',
+ 'child_only.html',
+ false,
+ true,
+ ),
+ array(
+ 'simple inheritance - both parent and child templates exist',
+ dirname(__FILE__) . '/templates/parent_and_child.html',
+ 'parent_and_child.html',
+ false,
+ true,
+ ),
+ array(
+ 'find first template - only child template exists in main style',
+ 'child_only.html',
+ array('parent_only.html', 'child_only.html'),
+ false,
+ false,
+ ),
+ array(
+ 'find first template - both templates exist in main style',
+ 'parent_and_child.html',
+ array('parent_and_child.html', 'child_only.html'),
+ false,
+ false,
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider template_data
+ */
+ public function test_template($name, $expected, $files, $return_default, $return_full_path)
+ {
+ // Reset the engine state
+ $this->setup_engine();
+
+ // Locate template
+ $result = $this->template->locate($files, $return_default, $return_full_path);
+ $this->assertSame($expected, $result);
+ }
+}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index edf621e16c..739bbe9387 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -15,7 +15,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
/**
* @todo put test data into templates/xyz.test
*/
- public static function template_data()
+ public function template_data()
{
return array(
/*
@@ -394,7 +394,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$this->run_template('php.html', array(), array(), array(), 'test', $cache_file);
}
- public static function alter_block_array_data()
+ public function alter_block_array_data()
{
return array(
array(
diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php
new file mode 100644
index 0000000000..e76d9436cf
--- /dev/null
+++ b/tests/template/template_test_case_with_tree.php
@@ -0,0 +1,29 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/template_test_case.php';
+
+class phpbb_template_template_test_case_with_tree extends phpbb_template_template_test_case
+{
+ protected function setup_engine(array $new_config = array())
+ {
+ global $phpbb_root_path, $phpEx, $user;
+
+ $defaults = $this->config_defaults();
+ $config = new phpbb_config(array_merge($defaults, $new_config));
+
+ $this->template_path = dirname(__FILE__) . '/templates';
+ $this->parent_template_path = dirname(__FILE__) . '/parent_templates';
+ $this->style_resource_locator = new phpbb_style_resource_locator();
+ $this->style_provider = new phpbb_style_path_provider();
+ $this->template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider);
+ $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
+ $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), '');
+ }
+}
diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html
new file mode 100644
index 0000000000..186fc30b43
--- /dev/null
+++ b/tests/template/templates/includejs.html
@@ -0,0 +1,5 @@
+<!-- INCLUDEJS parent_and_child.html -->
+<!-- INCLUDEJS {PARENT} -->
+<!-- DEFINE $TEST = 'child_only.html' -->
+<!-- INCLUDEJS {$TEST} -->
+{SCRIPTS} \ No newline at end of file
diff --git a/tests/text_processing/make_clickable_test.php b/tests/text_processing/make_clickable_test.php
index 8697907311..d94fac2ae4 100644
--- a/tests/text_processing/make_clickable_test.php
+++ b/tests/text_processing/make_clickable_test.php
@@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
class phpbb_text_processing_make_clickable_test extends phpbb_test_case
{
- public static function make_clickable_data()
+ public function make_clickable_data()
{
// value => whether it should work
$prefix_texts = array(
diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php
index 70bd549d5b..ae11e00fbd 100644
--- a/tests/utf/utf8_clean_string_test.php
+++ b/tests/utf/utf8_clean_string_test.php
@@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
class phpbb_utf_utf8_clean_string_test extends phpbb_test_case
{
- public static function cleanable_strings()
+ public function cleanable_strings()
{
return array(
array('MiXed CaSe', 'mixed case', 'Checking case folding'),