mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge remote-tracking branch 'upstream/develop' into feature/dic
* upstream/develop: (76 commits) [ticket/10561] Removed extra tabs, changes made to $db->sql_query() [ticket/10561] Changed $temp_style_id to $style_id [ticket/10561] Added function desc for phpbb_style_is_active() [ticket/10561] Casted $config['default_style'] to int [ticket/10561] Reverted to phpbb_style_is_active() [ticket/10561] Added to database_update:database_update_info() [ticket/10561] Added section in database_update.php [ticket/10764] FAQ now mentions Area51 instead of SourceForge [ticket/10764] FAQ now mentions GitHub instead of SourceForge [ticket/10455] Removed NOTE from prosilver overall_header.html. [ticket/10561] Moved and renamed the funtion validate_style(). [ticket/10575] Adding public visibility to the methods. [ticket/10575] Fixing non-static access to static functions get_instance [ticket/10547] User is not logged in as admin after installation [ticket/10650] Revert merge of 'rahulr92/ticket/10650' into develop [ticket/10650] Added checking for empty subjects [ticket/10650] Corrected intendation [ticket/10650]Added permission checking and utf8 functions [ticket/10650] Cropped subject and inserted newline [ticket/10650] Corrected space before true ...
This commit is contained in:
commit
9165a045c5
67 changed files with 954 additions and 490 deletions
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<div id="page-footer">
|
||||
<!-- IF S_COPYRIGHT_HTML -->
|
||||
Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © 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>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div id="page-footer">
|
||||
|
||||
<!-- IF S_COPYRIGHT_HTML -->
|
||||
<br />Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group
|
||||
<br />{CREDIT_LINE}
|
||||
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -98,7 +98,7 @@ class phpbb_captcha_qa
|
|||
/**
|
||||
* API function
|
||||
*/
|
||||
function get_instance()
|
||||
public static function get_instance()
|
||||
{
|
||||
$instance = new phpbb_captcha_qa();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>® Forum Software © 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) : '')
|
||||
);
|
||||
|
|
|
@ -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>® Forum Software © 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'])
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1947,6 +1947,27 @@ function validate_jabber($jid)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -38,12 +38,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
|
||||
|
@ -69,17 +63,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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,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
|
||||
*
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -856,6 +874,45 @@ class phpbb_style_template_filter extends php_user_filter
|
|||
return $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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:
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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':
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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?',
|
||||
|
|
|
@ -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.',
|
||||
|
||||
|
|
|
@ -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)',
|
||||
|
||||
|
|
|
@ -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 & 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.',
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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}">
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>® Forum Software © 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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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" />
|
||||
<input type="submit" accesskey="f" tabindex="7" name="full_editor" value="{L_FULL_EDITOR}" class="button2" data-ajax="false" />
|
||||
<input type="submit" accesskey="f" tabindex="6" name="preview" value="{L_FULL_EDITOR}" class="button2" data-ajax="false" id="qr_full_editor" />
|
||||
<input type="submit" accesskey="s" tabindex="7" name="post" value="{L_SUBMIT}" class="button1" />
|
||||
</fieldset>
|
||||
<span class="corners-bottom"><span></span></span></div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
</div>
|
||||
|
||||
<div class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © 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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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%;
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>® Forum Software © 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>
|
||||
|
|
|
@ -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}" />
|
||||
<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}" />
|
||||
<input class="btnmain" type="submit" accesskey="s" tabindex="7" name="post" value="{L_SUBMIT}" />
|
||||
|
||||
{S_FORM_TOKEN}
|
||||
{QR_HIDDEN_FIELDS}
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
</div>
|
||||
|
||||
<div id="wrapfooter">
|
||||
<span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © 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>
|
||||
|
|
|
@ -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'))),
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
|
|
31
tests/template/template_includejs_test.php
Normal file
31
tests/template/template_includejs_test.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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), '');
|
||||
}
|
||||
}
|
||||
|
|
68
tests/template/template_locate_test.php
Normal file
68
tests/template/template_locate_test.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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(
|
||||
|
|
29
tests/template/template_test_case_with_tree.php
Normal file
29
tests/template/template_test_case_with_tree.php
Normal file
|
@ -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), '');
|
||||
}
|
||||
}
|
5
tests/template/templates/includejs.html
Normal file
5
tests/template/templates/includejs.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!-- INCLUDEJS parent_and_child.html -->
|
||||
<!-- INCLUDEJS {PARENT} -->
|
||||
<!-- DEFINE $TEST = 'child_only.html' -->
|
||||
<!-- INCLUDEJS {$TEST} -->
|
||||
{SCRIPTS}
|
|
@ -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(
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Add table
Reference in a new issue