mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 05:38:52 +00:00
Merge branch 'develop' into feature/request-class
* develop: (157 commits) [ticket/10316] Resolve inconsistent move topic behavior [ticket/9297] Add network to class name of unit tests. [ticket/9297] Fix typo in localhost. [ticket/9297] Rename test class to reflect its contents. [ticket/9297] Adjust comment - IPv6 is needed for IPv6 connections to work. [ticket/9297] Fix markTestSkipped call in setUpBeforeClass. [ticket/9608] Remove use of references in topic_review [ticket/9297] Skip FTP PASV/EPSV test if FTP connection fails. [ticket/9297] Separate ipv4 and ipv6 tests into separate functions. [ticket/9297] Update copyright year of unit test file. [feature/template-engine] Delete _get_locator function. [feature/template-engine] Clean up template locator usage in bbcode. [ticket/9297] Make EPSV unit tests work without IPv6. [ticket/9297] Unit tests for ftp_fsock PASV and EPSV. [ticket/9297] Add support for Extended Passive Mode (EPSV) in ftp_fsock class. [ticket/10312] Un-check the shadow option while moving. [feature/template-engine] Need to call set_template on template. [feature/template-engine] Update installer for template engine changes. [feature/template-engine] Dependency inject locator into template. [feature/template-engine] Delete useless code from set_template. ... Conflicts: phpBB/includes/functions.php
This commit is contained in:
commit
38c65da553
130 changed files with 3557 additions and 2372 deletions
25
.gitignore
vendored
25
.gitignore
vendored
|
@ -1,13 +1,14 @@
|
||||||
*~
|
*~
|
||||||
phpunit.xml
|
/phpunit.xml
|
||||||
phpBB/cache/*.php
|
/phpBB/cache/*.html
|
||||||
phpBB/cache/queue.php.lock
|
/phpBB/cache/*.php
|
||||||
phpBB/config.php
|
/phpBB/cache/queue.php.lock
|
||||||
phpBB/files/*
|
/phpBB/config.php
|
||||||
phpBB/images/avatars/gallery/*
|
/phpBB/files/*
|
||||||
phpBB/images/avatars/upload/*
|
/phpBB/images/avatars/gallery/*
|
||||||
phpBB/store/*
|
/phpBB/images/avatars/upload/*
|
||||||
tests/phpbb_unit_tests.sqlite2
|
/phpBB/store/*
|
||||||
tests/test_config.php
|
/tests/phpbb_unit_tests.sqlite2
|
||||||
tests/tmp
|
/tests/test_config.php
|
||||||
tests/utf/data/*.txt
|
/tests/tmp
|
||||||
|
/tests/utf/data/*.txt
|
||||||
|
|
|
@ -49,19 +49,16 @@
|
||||||
--coverage-clover build/logs/clover.xml
|
--coverage-clover build/logs/clover.xml
|
||||||
--coverage-html build/coverage"
|
--coverage-html build/coverage"
|
||||||
passthru="true" />
|
passthru="true" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="test-slow" depends="clean,prepare">
|
||||||
<!-- Does not allow changing the working directory to tests/
|
<exec dir="."
|
||||||
so this approach does not work for us unfortunately
|
command="phpunit --log-junit build/logs/phpunit.xml
|
||||||
<phpunit codecoverage="true" haltonfailure="true">
|
--configuration phpunit.xml.all
|
||||||
<formatter todir="build/logs" type="xml"/>
|
--group slow
|
||||||
<batchtest>
|
--coverage-clover build/logs/clover-slow.xml
|
||||||
<fileset dir="tests">
|
--coverage-html build/coverage-slow"
|
||||||
<include name="all_tests.php"/>
|
passthru="true" />
|
||||||
</fileset>
|
|
||||||
</batchtest>
|
|
||||||
</phpunit>
|
|
||||||
-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="docs">
|
<target name="docs">
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="special_rank">{L_RANK_SPECIAL}:</label></dt>
|
<dt><label for="special_rank">{L_RANK_SPECIAL}:</label></dt>
|
||||||
<dd><label><input onclick="dE('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
<dd><label><input onclick="dE('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||||
<label><input onclick="dE('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
<label><input onclick="dE('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
|
<!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
w: '{LA_BBCODE_W_HELP}',
|
w: '{LA_BBCODE_W_HELP}',
|
||||||
s: '{LA_BBCODE_S_HELP}',
|
s: '{LA_BBCODE_S_HELP}',
|
||||||
f: '{LA_BBCODE_F_HELP}',
|
f: '{LA_BBCODE_F_HELP}',
|
||||||
e: '{LA_BBCODE_E_HELP}',
|
y: '{LA_BBCODE_Y_HELP}',
|
||||||
d: '{LA_BBCODE_D_HELP}',
|
d: '{LA_BBCODE_D_HELP}',
|
||||||
t: '{LA_BBCODE_T_HELP}',
|
|
||||||
tip: '{L_STYLES_TIP}'
|
tip: '{L_STYLES_TIP}'
|
||||||
<!-- BEGIN custom_tags -->
|
<!-- BEGIN custom_tags -->
|
||||||
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
||||||
|
@ -56,7 +55,7 @@
|
||||||
<input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
|
<input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" />
|
<input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" />
|
<input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="button2" accesskey="y" name="addlitsitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('e')" onmouseout="helpline('tip')" />
|
<input type="button" class="button2" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('y')" onmouseout="helpline('tip')" />
|
||||||
<!-- IF S_BBCODE_IMG -->
|
<!-- IF S_BBCODE_IMG -->
|
||||||
<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
|
<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<title>{L_COLOUR_SWATCH}</title>
|
<title>{L_COLOUR_SWATCH}</title>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @copyright (c) 2005 phpBB Group
|
* @copyright (c) 2005 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
* Minimum Requirement: PHP 4.3.3
|
* Minimum Requirement: PHP 5.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,6 @@ if (!empty($load_extensions) && function_exists('dl'))
|
||||||
|
|
||||||
// Include files
|
// Include files
|
||||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/template.' . $phpEx);
|
|
||||||
require($phpbb_root_path . 'includes/session.' . $phpEx);
|
require($phpbb_root_path . 'includes/session.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
||||||
|
|
||||||
|
@ -109,7 +108,6 @@ $class_loader->set_cache($cache->get_driver());
|
||||||
$request = new phpbb_request();
|
$request = new phpbb_request();
|
||||||
$user = new user();
|
$user = new user();
|
||||||
$auth = new auth();
|
$auth = new auth();
|
||||||
$template = new template();
|
|
||||||
$db = new $sql_db();
|
$db = new $sql_db();
|
||||||
|
|
||||||
// make sure request_var uses this request instance
|
// make sure request_var uses this request instance
|
||||||
|
@ -126,6 +124,9 @@ $config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
$template_locator = new phpbb_template_locator();
|
||||||
|
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
|
||||||
|
|
||||||
// Add own hook handler
|
// Add own hook handler
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||||
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
||||||
|
|
24
phpBB/develop/compile_template.php
Normal file
24
phpBB/develop/compile_template.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
//
|
||||||
|
// FILENAME : compile_template.php
|
||||||
|
// STARTED : Sun Apr 24, 2011
|
||||||
|
// COPYRIGHT : © 2011 phpBB Group
|
||||||
|
// WWW : http://www.phpbb.com/
|
||||||
|
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
|
||||||
|
//
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
|
define('IN_PHPBB', 1);
|
||||||
|
define('ANONYMOUS', 1);
|
||||||
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||||
|
$phpbb_root_path = './../';
|
||||||
|
|
||||||
|
include($phpbb_root_path . 'includes/template_compile.'.$phpEx);
|
||||||
|
|
||||||
|
$file = $argv[1];
|
||||||
|
|
||||||
|
$compile = new phpbb_template_compile();
|
||||||
|
echo $compile->compile_file($file);
|
|
@ -44,7 +44,7 @@ fwrite($fp, $contents);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$html_skeleton = '
|
$html_skeleton = '
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
||||||
|
@ -362,7 +362,7 @@ echo '<br>Store Files';
|
||||||
$fp = fopen($store_dir . 'index.html', 'w');
|
$fp = fopen($store_dir . 'index.html', 'w');
|
||||||
|
|
||||||
$html_data = '
|
$html_data = '
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
||||||
|
@ -427,7 +427,7 @@ fwrite($common_fp, "<?php\n\n \$lang = array(\n");
|
||||||
$fp = fopen($store_dir . 'lang_index.html', 'w');
|
$fp = fopen($store_dir . 'lang_index.html', 'w');
|
||||||
|
|
||||||
$html_data = '
|
$html_data = '
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
<link rel="stylesheet" href="subSilver.css" type="text/css">
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="phpBB 3.0.x Changelog" />
|
<meta name="description" content="phpBB 3.0.x Changelog" />
|
||||||
<title>phpBB3 • Changelog</title>
|
<title>phpBB3 • Changelog</title>
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="phpBB 3.0.x frequently asked questions" />
|
<meta name="description" content="phpBB 3.0.x frequently asked questions" />
|
||||||
<title>phpBB3 • FAQ</title>
|
<title>phpBB3 • FAQ</title>
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="phpBB 3.0.x Installation, updating and conversion informations" />
|
<meta name="description" content="phpBB 3.0.x Installation, updating and conversion informations" />
|
||||||
<title>phpBB3 • Install</title>
|
<title>phpBB3 • Install</title>
|
||||||
|
@ -145,7 +138,7 @@
|
||||||
<li>Oracle</li>
|
<li>Oracle</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>PHP 4.3.3+ (>=4.3.3, >4.4.x, >5.x.x, >6.0-dev (compatible))</strong> with support for the database you intend to use.</li>
|
<li><strong>PHP 5.2.0+</strong> with support for the database you intend to use.</li>
|
||||||
<li>getimagesize() function need to be enabled.</li>
|
<li>getimagesize() function need to be enabled.</li>
|
||||||
<li>These optional presence of the following modules within PHP will provide access to additional features, but they are not required.
|
<li>These optional presence of the following modules within PHP will provide access to additional features, but they are not required.
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="phpBB 3.0.x Readme" />
|
<meta name="description" content="phpBB 3.0.x Readme" />
|
||||||
<title>phpBB3 • Readme</title>
|
<title>phpBB3 • Readme</title>
|
||||||
|
@ -313,11 +306,11 @@
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<p>phpBB is no longer supported on PHP3 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 4.3.3.</p>
|
<p>phpBB is no longer supported on PHP4 due to several compatibility issues and we recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 5.2.0.</p>
|
||||||
|
|
||||||
<p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
|
<p>Please remember that running any application on a developmental version of PHP can lead to strange/unexpected results which may appear to be bugs in the application (which may not be true). Therefore we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a developmental version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
|
||||||
|
|
||||||
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 7.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 4.3.3 to 6.0.0-dev without problem. </p>
|
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MSSQL Server 2000, PostgreSQL 7.x, Oracle 8, SQLite and Firebird. Versions of PHP used range from 5.2.0 to 5.3.x without problem.</p>
|
||||||
|
|
||||||
<a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3>
|
<a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" />
|
<meta name="description" content="This is an explanation of how to use the phpBB auth/acl API" />
|
||||||
<title>phpBB3 • Auth API</title>
|
<title>phpBB3 • Auth API</title>
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="Olympus coding guidelines document" />
|
<meta name="description" content="Olympus coding guidelines document" />
|
||||||
<title>phpBB3 • Coding Guidelines</title>
|
<title>phpBB3 • Coding Guidelines</title>
|
||||||
|
@ -1770,7 +1763,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>With phpBB3, the output encoding for the forum in now UTF-8, a Universal Character Encoding by the Unicode Consortium that is by design a superset to US-ASCII and ISO-8859-1. By using one character set which simultaenously supports all scripts which previously would have required different encodings (eg: ISO-8859-1 to ISO-8859-15 (Latin, Greek, Cyrillic, Thai, Hebrew, Arabic); GB2312 (Simplified Chinese); Big5 (Traditional Chinese), EUC-JP (Japanese), EUC-KR (Korean), VISCII (Vietnamese); et cetera), this removes the need to convert between encodings and improves the accessibility of multilingual forums.</p>
|
<p>With phpBB3, the output encoding for the forum in now UTF-8, a Universal Character Encoding by the Unicode Consortium that is by design a superset to US-ASCII and ISO-8859-1. By using one character set which simultaenously supports all scripts which previously would have required different encodings (eg: ISO-8859-1 to ISO-8859-15 (Latin, Greek, Cyrillic, Thai, Hebrew, Arabic); GB2312 (Simplified Chinese); Big5 (Traditional Chinese), EUC-JP (Japanese), EUC-KR (Korean), VISCII (Vietnamese); et cetera), this removes the need to convert between encodings and improves the accessibility of multilingual forums.</p>
|
||||||
|
|
||||||
<p>The impact is that the language files for phpBB must now also be encoded as UTF-8, with a caveat that the files must <strong>not contain</strong> a <acronym title="Byte-Order-Mark">BOM</acronym> for compatibility reasons with non-Unicode aware versions of PHP. For those with forums using the Latin character set (ie: most European languages), this change is transparent since UTF-8 is superset to US-ASCII and ISO-8859-1.</p>
|
<p>The impact is that the language files for phpBB must now also be encoded as UTF-8, with a caveat that the files must <strong>not contain</strong> a <abbr title="Byte-Order-Mark">BOM</abbr> for compatibility reasons with non-Unicode aware versions of PHP. For those with forums using the Latin character set (ie: most European languages), this change is transparent since UTF-8 is superset to US-ASCII and ISO-8859-1.</p>
|
||||||
|
|
||||||
<h4>Language Tag:</h4>
|
<h4>Language Tag:</h4>
|
||||||
|
|
||||||
|
@ -1780,8 +1773,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>Most language tags consist of a two- or three-letter language subtag (from <a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO 639-1/ISO 639-2</a>). Sometimes, this is followed by a two-letter or three-digit region subtag (from <a href="http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1 alpha-2</a> or <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">UN M.49</a>). Some examples are:</p>
|
<p>Most language tags consist of a two- or three-letter language subtag (from <a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO 639-1/ISO 639-2</a>). Sometimes, this is followed by a two-letter or three-digit region subtag (from <a href="http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1 alpha-2</a> or <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">UN M.49</a>). Some examples are:</p>
|
||||||
|
|
||||||
<table summary="Examples of various possible language tags as described by RFC 4646 and RFC 4647">
|
<table>
|
||||||
<caption>Language tag examples</caption>
|
<caption>Examples of various possible language tags as described by RFC 4646 and RFC 4647</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Language tag</th>
|
<th scope="col">Language tag</th>
|
||||||
|
@ -1832,8 +1825,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>Next is the <a href="http://www.unicode.org/iso15924/iso15924-codes.html">ISO 15924</a> language script code and when one should or shouldn't use it. For example, whilst <code>en-Latn</code> is syntaxically correct for describing English written with Latin script, real world English writing is <strong>more-or-less exclusively in the Latin script</strong>. For such languages like English that are written in a single script, the <a href="http://www.iana.org/assignments/language-subtag-registry"><abbr title="Internet Assigned Numbers Authority">IANA</abbr> Language Subtag Registry</a> has a "Suppress-Script" field meaning the script code <strong>should be ommitted</strong> unless a specific language tag requires a specific script code. Some languages are <strong>written in more than one script</strong> and in such cases, the script code <strong>is encouraged</strong> since an end-user may be able to read their language in one script, but not the other. Some examples are:</p>
|
<p>Next is the <a href="http://www.unicode.org/iso15924/iso15924-codes.html">ISO 15924</a> language script code and when one should or shouldn't use it. For example, whilst <code>en-Latn</code> is syntaxically correct for describing English written with Latin script, real world English writing is <strong>more-or-less exclusively in the Latin script</strong>. For such languages like English that are written in a single script, the <a href="http://www.iana.org/assignments/language-subtag-registry"><abbr title="Internet Assigned Numbers Authority">IANA</abbr> Language Subtag Registry</a> has a "Suppress-Script" field meaning the script code <strong>should be ommitted</strong> unless a specific language tag requires a specific script code. Some languages are <strong>written in more than one script</strong> and in such cases, the script code <strong>is encouraged</strong> since an end-user may be able to read their language in one script, but not the other. Some examples are:</p>
|
||||||
|
|
||||||
<table summary="Examples of using a language subtag in combination with a script subtag">
|
<table>
|
||||||
<caption>Language subtag + script subtag examples</caption>
|
<caption>Examples of using a language subtag in combination with a script subtag</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Language tag</th>
|
<th scope="col">Language tag</th>
|
||||||
|
@ -1899,8 +1892,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>Examples of English using marco-geographical regions:</p>
|
<p>Examples of English using marco-geographical regions:</p>
|
||||||
|
|
||||||
<table summary="Examples for English of ISO 3166-1 alpha-2 vs. UN M.49 code">
|
<table>
|
||||||
<caption>Coding for English using macro-geographical regions</caption>
|
<caption>Coding for English using macro-geographical regions (examples for English of ISO 3166-1 alpha-2 vs. UN M.49 code)</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2</th>
|
<th scope="col">ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2</th>
|
||||||
|
@ -1925,8 +1918,8 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>Examples of Spanish using marco-geographical regions:</p>
|
<p>Examples of Spanish using marco-geographical regions:</p>
|
||||||
|
|
||||||
<table summary="Examples for Spanish of ISO 3166-1 alpha-2 vs. UN M.49 code">
|
<table>
|
||||||
<caption>Coding for Spanish macro-geographical regions</caption>
|
<caption>Coding for Spanish macro-geographical regions (examples for Spanish of ISO 3166-1 alpha-2 vs. UN M.49 code)</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2</th>
|
<th scope="col">ISO 639-1/ISO 639-2 + ISO 3166-1 alpha-2</th>
|
||||||
|
@ -1954,7 +1947,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>Example of where the <a href="http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1 alpha-2</a> is ambiguous and why <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">UN M.49</a> might be preferred:</p>
|
<p>Example of where the <a href="http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1 alpha-2</a> is ambiguous and why <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">UN M.49</a> might be preferred:</p>
|
||||||
|
|
||||||
<table summary="Example where the ISO 3166-1 alpha-2 is ambiguous">
|
<table>
|
||||||
<caption>Coding for ambiguous ISO 3166-1 alpha-2 regions</caption>
|
<caption>Coding for ambiguous ISO 3166-1 alpha-2 regions</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2010,7 +2003,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p><a href="http://tools.ietf.org/html/rfc4646">RFC 4646</a> anticipates features which shall be available in (currently draft) <a href="http://www.sil.org/iso639-3/">ISO 639-3</a> which aims to provide as complete enumeration of languages as possible, including living, extinct, ancient and constructed languages, whether majour, minor or unwritten. A new feature of <a href="http://www.sil.org/iso639-3/">ISO 639-3</a> compared to the previous two revisions is the concept of <a href="http://www.sil.org/iso639-3/macrolanguages.asp">macrolanguages</a> where Arabic and Chinese are two such examples. In such cases, their respective codes of <code>ar</code> and <code>zh</code> is very vague as to which dialect/topolect is used or perhaps some terse classical variant which may be difficult for all but very educated users. For such macrolanguages, it is recommended that the sub-language tag is used as a suffix to the macrolanguage tag, eg:</p>
|
<p><a href="http://tools.ietf.org/html/rfc4646">RFC 4646</a> anticipates features which shall be available in (currently draft) <a href="http://www.sil.org/iso639-3/">ISO 639-3</a> which aims to provide as complete enumeration of languages as possible, including living, extinct, ancient and constructed languages, whether majour, minor or unwritten. A new feature of <a href="http://www.sil.org/iso639-3/">ISO 639-3</a> compared to the previous two revisions is the concept of <a href="http://www.sil.org/iso639-3/macrolanguages.asp">macrolanguages</a> where Arabic and Chinese are two such examples. In such cases, their respective codes of <code>ar</code> and <code>zh</code> is very vague as to which dialect/topolect is used or perhaps some terse classical variant which may be difficult for all but very educated users. For such macrolanguages, it is recommended that the sub-language tag is used as a suffix to the macrolanguage tag, eg:</p>
|
||||||
|
|
||||||
<table summary="Examples of macrolanguages used with sub-language subtags">
|
<table>
|
||||||
<caption>Macrolanguage subtag + sub-language subtag examples</caption>
|
<caption>Macrolanguage subtag + sub-language subtag examples</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2054,7 +2047,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>For phpBB, the language tags are <strong>not</strong> used in their raw form and instead converted to all lower-case and have the hyphen <code>-</code> replaced with an underscore <code>_</code> where appropriate, with some examples below:</p>
|
<p>For phpBB, the language tags are <strong>not</strong> used in their raw form and instead converted to all lower-case and have the hyphen <code>-</code> replaced with an underscore <code>_</code> where appropriate, with some examples below:</p>
|
||||||
|
|
||||||
<table summary="Normalisation of language tags for usage in phpBB">
|
<table>
|
||||||
<caption>Language tag normalisation examples</caption>
|
<caption>Language tag normalisation examples</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2108,7 +2101,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>For the English language description, the language name is always first and any additional attributes required to describe the subtags within the language code are then listed in order separated with commas and enclosed within parentheses, eg:</p>
|
<p>For the English language description, the language name is always first and any additional attributes required to describe the subtags within the language code are then listed in order separated with commas and enclosed within parentheses, eg:</p>
|
||||||
|
|
||||||
<table summary="English language description examples of iso.txt for usage in phpBB">
|
<table>
|
||||||
<caption>English language description examples for iso.txt</caption>
|
<caption>English language description examples for iso.txt</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2160,7 +2153,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>The various Unicode control characters for bi-directional text and their HTML enquivalents where appropriate are as follows:</p>
|
<p>The various Unicode control characters for bi-directional text and their HTML enquivalents where appropriate are as follows:</p>
|
||||||
|
|
||||||
<table summary="Table of the various Unicode bidirectional control characters">
|
<table>
|
||||||
<caption>Unicode bidirectional control characters & HTML elements/entities</caption>
|
<caption>Unicode bidirectional control characters & HTML elements/entities</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2226,7 +2219,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<p>For <code>iso.txt</code>, the directionality of the text can be explicitly set using special Unicode characters via any of the three methods provided by left-to-right/right-to-left markers/embeds/overrides, as without them, the ordering of characters will be incorrect, eg:</p>
|
<p>For <code>iso.txt</code>, the directionality of the text can be explicitly set using special Unicode characters via any of the three methods provided by left-to-right/right-to-left markers/embeds/overrides, as without them, the ordering of characters will be incorrect, eg:</p>
|
||||||
|
|
||||||
<table summary="Effect of using Unicode bidirectional control characters within iso.txt">
|
<table>
|
||||||
<caption>Unicode bidirectional control characters iso.txt</caption>
|
<caption>Unicode bidirectional control characters iso.txt</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -2362,7 +2355,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
...
|
...
|
||||||
'FOO_BAR' => 'PHP version < 4.3.3.<br />
|
'FOO_BAR' => 'PHP version < 5.2.0.<br />
|
||||||
Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.',
|
Visit "Downloads" at <a href="http://www.php.net/">www.php.net</a>.',
|
||||||
...
|
...
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
@ -2371,7 +2364,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
...
|
...
|
||||||
'FOO_BAR' => 'PHP version &lt; 4.3.3.<br />
|
'FOO_BAR' => 'PHP version &lt; 5.2.0.<br />
|
||||||
Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.',
|
Visit &quot;Downloads&quot; at <a href="http://www.php.net/">www.php.net</a>.',
|
||||||
...
|
...
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
@ -2380,7 +2373,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
...
|
...
|
||||||
'FOO_BAR' => 'PHP version &lt; 4.3.3.<br />
|
'FOO_BAR' => 'PHP version &lt; 5.2.0.<br />
|
||||||
Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.',
|
Visit “Downloads” at <a href="http://www.php.net/">www.php.net</a>.',
|
||||||
...
|
...
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
<html dir="ltr" lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="en" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="copyright" content="phpBB Group" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="Hook System explanation" />
|
<meta name="description" content="Hook System explanation" />
|
||||||
<title>phpBB3 • Hook System</title>
|
<title>phpBB3 • Hook System</title>
|
||||||
|
@ -377,10 +370,10 @@ a:active { color: #368AD2; }
|
||||||
|
|
||||||
<p><code>phpbb_user_session_handler();</code> which is called within user::setup after the session and the user object is correctly initialized.<br />
|
<p><code>phpbb_user_session_handler();</code> which is called within user::setup after the session and the user object is correctly initialized.<br />
|
||||||
<code>append_sid($url, $params = false, $is_amp = true, $session_id = false);</code> which is called for building urls (appending the session id)<br />
|
<code>append_sid($url, $params = false, $is_amp = true, $session_id = false);</code> which is called for building urls (appending the session id)<br />
|
||||||
<code>$template->display($handle, $include_once = true);</code> which is called directly before outputting the (not-yet-compiled) template.<br />
|
<code>$template->display($handle, $template);</code> which is called directly before outputting the (not-yet-compiled) template.<br />
|
||||||
<code>exit_handler();</code> which is called at the very end of phpBB3's execution.</p>
|
<code>exit_handler();</code> which is called at the very end of phpBB3's execution.</p>
|
||||||
|
|
||||||
<p>Please note: The <code>$template->display</code> hook takes a third <code>$template</code> argument, which is the template instance being used, which should be used instead of the global.</p>
|
<p>Please note: The <code>$template->display</code> hook takes a <code>$template</code> argument, which is the template instance being used, which should be used instead of the global.</p>
|
||||||
|
|
||||||
<p>There are also valid external constants you may want to use if you embed phpBB3 into your application:</p>
|
<p>There are also valid external constants you may want to use if you embed phpBB3 into your application:</p>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class acp_captcha
|
||||||
// Delegate
|
// Delegate
|
||||||
if ($configure)
|
if ($configure)
|
||||||
{
|
{
|
||||||
$config_captcha =& phpbb_captcha_factory::get_instance($selected);
|
$config_captcha = phpbb_captcha_factory::get_instance($selected);
|
||||||
$config_captcha->acp_page($id, $this);
|
$config_captcha->acp_page($id, $this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -78,11 +78,11 @@ class acp_captcha
|
||||||
// sanity check
|
// sanity check
|
||||||
if (isset($captchas['available'][$selected]))
|
if (isset($captchas['available'][$selected]))
|
||||||
{
|
{
|
||||||
$old_captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
$old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
||||||
$old_captcha->uninstall();
|
$old_captcha->uninstall();
|
||||||
|
|
||||||
set_config('captcha_plugin', $selected);
|
set_config('captcha_plugin', $selected);
|
||||||
$new_captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
$new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
||||||
$new_captcha->install();
|
$new_captcha->install();
|
||||||
|
|
||||||
add_log('admin', 'LOG_CONFIG_VISUAL');
|
add_log('admin', 'LOG_CONFIG_VISUAL');
|
||||||
|
@ -113,7 +113,7 @@ class acp_captcha
|
||||||
$captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang[$title] . '</option>';
|
$captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang[$title] . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$demo_captcha =& phpbb_captcha_factory::get_instance($selected);
|
$demo_captcha = phpbb_captcha_factory::get_instance($selected);
|
||||||
|
|
||||||
foreach ($config_vars as $config_var => $options)
|
foreach ($config_vars as $config_var => $options)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ class acp_captcha
|
||||||
{
|
{
|
||||||
global $db, $user, $config;
|
global $db, $user, $config;
|
||||||
|
|
||||||
$captcha =& phpbb_captcha_factory::get_instance($selected);
|
$captcha = phpbb_captcha_factory::get_instance($selected);
|
||||||
$captcha->init(CONFIRM_REG);
|
$captcha->init(CONFIRM_REG);
|
||||||
$captcha->execute_demo();
|
$captcha->execute_demo();
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ class acp_inactive
|
||||||
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true),
|
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true),
|
||||||
'USERS_PER_PAGE' => $per_page,
|
'USERS_PER_PAGE' => $per_page,
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action . '&start=' . $start,
|
'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start",
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->tpl_name = 'acp_inactive';
|
$this->tpl_name = 'acp_inactive';
|
||||||
|
|
|
@ -128,12 +128,12 @@ class acp_logs
|
||||||
// Grab log data
|
// Grab log data
|
||||||
$log_data = array();
|
$log_data = array();
|
||||||
$log_count = 0;
|
$log_count = 0;
|
||||||
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
|
$start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_TITLE' => $l_title,
|
'L_TITLE' => $l_title,
|
||||||
'L_EXPLAIN' => $l_title_explain,
|
'L_EXPLAIN' => $l_title_explain,
|
||||||
'U_ACTION' => $this->u_action,
|
'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
|
||||||
|
|
||||||
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
|
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
|
||||||
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true),
|
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true),
|
||||||
|
|
|
@ -415,11 +415,8 @@ class acp_main
|
||||||
{
|
{
|
||||||
$latest_version_info = explode("\n", $latest_version_info);
|
$latest_version_info = explode("\n", $latest_version_info);
|
||||||
|
|
||||||
$latest_version = str_replace('rc', 'RC', strtolower(trim($latest_version_info[0])));
|
|
||||||
$current_version = str_replace('rc', 'RC', strtolower($config['version']));
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_VERSION_UP_TO_DATE' => version_compare($current_version, $latest_version, '<') ? false : true,
|
'S_VERSION_UP_TO_DATE' => phpbb_version_compare(trim($latest_version_info[0]), $config['version'], '<='),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +518,7 @@ class acp_main
|
||||||
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'),
|
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'),
|
||||||
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'),
|
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'),
|
||||||
'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'),
|
'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'),
|
||||||
'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=1&versioncheck_force=1'),
|
'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'),
|
||||||
|
|
||||||
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
||||||
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
||||||
|
|
|
@ -67,6 +67,9 @@ class acp_php_info
|
||||||
$output = preg_replace('#<img border="0"#i', '<img', $output);
|
$output = preg_replace('#<img border="0"#i', '<img', $output);
|
||||||
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
|
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
|
||||||
|
|
||||||
|
// Fix invalid anchor names (eg "module_Zend Optimizer")
|
||||||
|
$output = preg_replace_callback('#<a name="([^"]+)">#', array($this, 'remove_spaces'), $output);
|
||||||
|
|
||||||
if (empty($output))
|
if (empty($output))
|
||||||
{
|
{
|
||||||
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
||||||
|
@ -79,4 +82,9 @@ class acp_php_info
|
||||||
|
|
||||||
$template->assign_var('PHPINFO', $output);
|
$template->assign_var('PHPINFO', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_spaces($matches)
|
||||||
|
{
|
||||||
|
return '<a name="' . str_replace(' ', '_', $matches[1]) . '">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package acp
|
* @package acp
|
||||||
*/
|
*/
|
||||||
|
@ -27,7 +25,9 @@ class acp_send_statistics
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $template, $phpbb_admin_path, $phpEx;
|
global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
|
||||||
|
|
||||||
$collect_url = "http://www.phpbb.com/stats/receive_stats.php";
|
$collect_url = "http://www.phpbb.com/stats/receive_stats.php";
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,9 @@ class acp_update
|
||||||
|
|
||||||
$current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
|
$current_version = (!empty($version_update_from)) ? $version_update_from : $config['version'];
|
||||||
|
|
||||||
$up_to_date_automatic = (version_compare(str_replace('rc', 'RC', strtolower($current_version)), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
|
||||||
$up_to_date = (version_compare(str_replace('rc', 'RC', strtolower($config['version'])), str_replace('rc', 'RC', strtolower($latest_version)), '<')) ? false : true;
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_UP_TO_DATE' => $up_to_date,
|
'S_UP_TO_DATE' => phpbb_version_compare($latest_version, $config['version'], '<='),
|
||||||
'S_UP_TO_DATE_AUTO' => $up_to_date_automatic,
|
'S_UP_TO_DATE_AUTO' => phpbb_version_compare($latest_version, $current_version, '<='),
|
||||||
'S_VERSION_CHECK' => true,
|
'S_VERSION_CHECK' => true,
|
||||||
'U_ACTION' => $this->u_action,
|
'U_ACTION' => $this->u_action,
|
||||||
'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'),
|
'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'),
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ class acp_users
|
||||||
// Grab log data
|
// Grab log data
|
||||||
$log_data = array();
|
$log_data = array();
|
||||||
$log_count = 0;
|
$log_count = 0;
|
||||||
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
|
$start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_FEEDBACK' => true,
|
'S_FEEDBACK' => true,
|
||||||
|
|
|
@ -349,6 +349,14 @@ class auth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get permission listing based on user_id/options/forum_ids
|
* Get permission listing based on user_id/options/forum_ids
|
||||||
|
*
|
||||||
|
* Be careful when using this function with permissions a_, m_, u_ and f_ !
|
||||||
|
* It may not work correctly. When a user group grants an a_* permission,
|
||||||
|
* e.g. a_foo, but the user's a_foo permission is set to "Never", then
|
||||||
|
* the user does not in fact have the a_ permission.
|
||||||
|
* But the user will still be listed as having the a_ permission.
|
||||||
|
*
|
||||||
|
* For more information see: http://tracker.phpbb.com/browse/PHPBB3-10252
|
||||||
*/
|
*/
|
||||||
function acl_get_list($user_id = false, $opts = false, $forum_id = false)
|
function acl_get_list($user_id = false, $opts = false, $forum_id = false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,7 +129,7 @@ function login_db($username, $password, $ip = '', $browser = '', $forwarded_for
|
||||||
include ($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
include ($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
$captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
||||||
$captcha->init(CONFIRM_LOGIN);
|
$captcha->init(CONFIRM_LOGIN);
|
||||||
$vc_response = $captcha->validate($row);
|
$vc_response = $captcha->validate($row);
|
||||||
if ($vc_response)
|
if ($vc_response)
|
||||||
|
|
|
@ -30,7 +30,6 @@ class bbcode
|
||||||
var $bbcodes = array();
|
var $bbcodes = array();
|
||||||
|
|
||||||
var $template_bitfield;
|
var $template_bitfield;
|
||||||
var $template_filename = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -128,28 +127,17 @@ class bbcode
|
||||||
*/
|
*/
|
||||||
function bbcode_cache_init()
|
function bbcode_cache_init()
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $template, $user;
|
global $phpbb_root_path, $phpEx, $config, $user;
|
||||||
|
|
||||||
if (empty($this->template_filename))
|
if (empty($this->template_filename))
|
||||||
{
|
{
|
||||||
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
|
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
|
||||||
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
|
|
||||||
|
|
||||||
if (!@file_exists($this->template_filename))
|
$template_locator = new phpbb_template_locator();
|
||||||
{
|
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
|
||||||
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
|
$template->set_template();
|
||||||
{
|
$template_locator->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
||||||
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html';
|
$this->template_filename = $template_locator->get_source_file_for_handle('bbcode.html');
|
||||||
if (!@file_exists($this->template_filename))
|
|
||||||
{
|
|
||||||
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$bbcode_ids = $rowset = $sql = array();
|
$bbcode_ids = $rowset = $sql = array();
|
||||||
|
@ -584,6 +572,13 @@ class bbcode
|
||||||
$code = str_replace("\t", ' ', $code);
|
$code = str_replace("\t", ' ', $code);
|
||||||
$code = str_replace(' ', ' ', $code);
|
$code = str_replace(' ', ' ', $code);
|
||||||
$code = str_replace(' ', ' ', $code);
|
$code = str_replace(' ', ' ', $code);
|
||||||
|
$code = str_replace("\n ", "\n ", $code);
|
||||||
|
|
||||||
|
// keep space at the beginning
|
||||||
|
if (!empty($code) && $code[0] == ' ')
|
||||||
|
{
|
||||||
|
$code = ' ' . substr($code, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// remove newline at the beginning
|
// remove newline at the beginning
|
||||||
if (!empty($code) && $code[0] == "\n")
|
if (!empty($code) && $code[0] == "\n")
|
||||||
|
|
|
@ -26,7 +26,7 @@ class phpbb_captcha_factory
|
||||||
/**
|
/**
|
||||||
* return an instance of class $name in file $name_plugin.php
|
* return an instance of class $name in file $name_plugin.php
|
||||||
*/
|
*/
|
||||||
function &get_instance($name)
|
function get_instance($name)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ class phpbb_captcha_gd extends phpbb_default_captcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function &get_instance()
|
function get_instance()
|
||||||
{
|
{
|
||||||
$instance =& new phpbb_captcha_gd();
|
$instance = new phpbb_captcha_gd();
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ class phpbb_captcha_nogd extends phpbb_default_captcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function &get_instance()
|
function get_instance()
|
||||||
{
|
{
|
||||||
$instance =& new phpbb_captcha_nogd();
|
$instance = new phpbb_captcha_nogd();
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,9 @@ class phpbb_captcha_qa
|
||||||
/**
|
/**
|
||||||
* API function
|
* API function
|
||||||
*/
|
*/
|
||||||
function &get_instance()
|
function get_instance()
|
||||||
{
|
{
|
||||||
$instance =& new phpbb_captcha_qa();
|
$instance = new phpbb_captcha_qa();
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ class phpbb_recaptcha extends phpbb_default_captcha
|
||||||
$this->response = request_var('recaptcha_response_field', '');
|
$this->response = request_var('recaptcha_response_field', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function &get_instance()
|
function get_instance()
|
||||||
{
|
{
|
||||||
$instance =& new phpbb_recaptcha();
|
$instance = new phpbb_recaptcha();
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2059,7 +2059,7 @@ class phpbb_db_tools
|
||||||
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
$max_length = $table_prefix + 24;
|
$max_length = strlen($table_prefix) + 24;
|
||||||
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2096,7 +2096,7 @@ class phpbb_db_tools
|
||||||
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
|
||||||
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
|
||||||
{
|
{
|
||||||
$max_length = $table_prefix + 24;
|
$max_length = strlen($table_prefix) + 24;
|
||||||
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -767,12 +767,10 @@ class dbal
|
||||||
$mtime = explode(' ', microtime());
|
$mtime = explode(' ', microtime());
|
||||||
$totaltime = $mtime[0] + $mtime[1] - $starttime;
|
$totaltime = $mtime[0] + $mtime[1] - $starttime;
|
||||||
|
|
||||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
echo '<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
|
<html dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<title>SQL Report</title>
|
<title>SQL Report</title>
|
||||||
<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -43,7 +43,23 @@ class dbal_mysqli extends dbal
|
||||||
$this->dbname = $database;
|
$this->dbname = $database;
|
||||||
$port = (!$port) ? NULL : $port;
|
$port = (!$port) ? NULL : $port;
|
||||||
|
|
||||||
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port);
|
// If port is set and it is not numeric, most likely mysqli socket is set.
|
||||||
|
// Try to map it to the $socket parameter.
|
||||||
|
$socket = NULL;
|
||||||
|
if ($port)
|
||||||
|
{
|
||||||
|
if (is_numeric($port))
|
||||||
|
{
|
||||||
|
$port = (int) $port;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$socket = $port;
|
||||||
|
$port = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket);
|
||||||
|
|
||||||
if ($this->db_connect_id && $this->dbname != '')
|
if ($this->db_connect_id && $this->dbname != '')
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,6 +206,27 @@ function phpbb_mt_rand($min, $max)
|
||||||
return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max);
|
return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for getdate() which returns the equivalent array for UTC timestamps.
|
||||||
|
*
|
||||||
|
* @param int $time Unix timestamp (optional)
|
||||||
|
*
|
||||||
|
* @return array Returns an associative array of information related to the timestamp.
|
||||||
|
* See http://www.php.net/manual/en/function.getdate.php
|
||||||
|
*/
|
||||||
|
function phpbb_gmgetdate($time = false)
|
||||||
|
{
|
||||||
|
if ($time === false)
|
||||||
|
{
|
||||||
|
$time = time();
|
||||||
|
}
|
||||||
|
|
||||||
|
// getdate() interprets timestamps in local time.
|
||||||
|
// What follows uses the fact that getdate() and
|
||||||
|
// date('Z') balance each other out.
|
||||||
|
return getdate($time - date('Z'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return formatted string for filesizes
|
* Return formatted string for filesizes
|
||||||
*
|
*
|
||||||
|
@ -527,6 +548,34 @@ function phpbb_email_hash($email)
|
||||||
return sprintf('%u', crc32(strtolower($email))) . strlen($email);
|
return sprintf('%u', crc32(strtolower($email))) . strlen($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for version_compare() that allows using uppercase A and B
|
||||||
|
* for alpha and beta releases.
|
||||||
|
*
|
||||||
|
* See http://www.php.net/manual/en/function.version-compare.php
|
||||||
|
*
|
||||||
|
* @param string $version1 First version number
|
||||||
|
* @param string $version2 Second version number
|
||||||
|
* @param string $operator Comparison operator (optional)
|
||||||
|
*
|
||||||
|
* @return mixed Boolean (true, false) if comparison operator is specified.
|
||||||
|
* Integer (-1, 0, 1) otherwise.
|
||||||
|
*/
|
||||||
|
function phpbb_version_compare($version1, $version2, $operator = null)
|
||||||
|
{
|
||||||
|
$version1 = strtolower($version1);
|
||||||
|
$version2 = strtolower($version2);
|
||||||
|
|
||||||
|
if (is_null($operator))
|
||||||
|
{
|
||||||
|
return version_compare($version1, $version2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return version_compare($version1, $version2, $operator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global function for chmodding directories and files for internal use
|
* Global function for chmodding directories and files for internal use
|
||||||
*
|
*
|
||||||
|
@ -768,7 +817,7 @@ function phpbb_is_writable($file)
|
||||||
* @param string $path Path to check absoluteness of
|
* @param string $path Path to check absoluteness of
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function is_absolute($path)
|
function phpbb_is_absolute($path)
|
||||||
{
|
{
|
||||||
return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false;
|
return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false;
|
||||||
}
|
}
|
||||||
|
@ -790,7 +839,7 @@ function phpbb_own_realpath($path)
|
||||||
$path_prefix = '';
|
$path_prefix = '';
|
||||||
|
|
||||||
// Determine what sort of path we have
|
// Determine what sort of path we have
|
||||||
if (is_absolute($path))
|
if (phpbb_is_absolute($path))
|
||||||
{
|
{
|
||||||
$absolute = true;
|
$absolute = true;
|
||||||
|
|
||||||
|
@ -2250,10 +2299,10 @@ function redirect($url, $return = false, $disable_cd_check = false)
|
||||||
{
|
{
|
||||||
header('Refresh: 0; URL=' . $url);
|
header('Refresh: 0; URL=' . $url);
|
||||||
|
|
||||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
echo '<!DOCTYPE html>';
|
||||||
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="' . $user->lang['DIRECTION'] . '" lang="' . $user->lang['USER_LANG'] . '" xml:lang="' . $user->lang['USER_LANG'] . '">';
|
echo '<html dir="' . $user->lang['DIRECTION'] . '" lang="' . $user->lang['USER_LANG'] . '">';
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
echo '<meta charset="utf-8">';
|
||||||
echo '<meta http-equiv="refresh" content="0; url=' . str_replace('&', '&', $url) . '" />';
|
echo '<meta http-equiv="refresh" content="0; url=' . str_replace('&', '&', $url) . '" />';
|
||||||
echo '<title>' . $user->lang['REDIRECT'] . '</title>';
|
echo '<title>' . $user->lang['REDIRECT'] . '</title>';
|
||||||
echo '</head>';
|
echo '</head>';
|
||||||
|
@ -2434,12 +2483,6 @@ function send_status_line($code, $message)
|
||||||
{
|
{
|
||||||
$version = $request->server('SERVER_PROTOCOL');
|
$version = $request->server('SERVER_PROTOCOL');
|
||||||
}
|
}
|
||||||
else if ($request->server('HTTP_VERSION'))
|
|
||||||
{
|
|
||||||
// I cannot remember where I got this from.
|
|
||||||
// This code path may never be reachable in reality.
|
|
||||||
$version = $request->server('HTTP_VERSION');
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$version = 'HTTP/1.0';
|
$version = 'HTTP/1.0';
|
||||||
|
@ -3628,10 +3671,19 @@ function phpbb_checkdnsrr($host, $type = 'MX')
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case 'A':
|
|
||||||
case 'AAAA':
|
case 'AAAA':
|
||||||
|
// AAAA records returned by nslookup on Windows XP/2003 have this format.
|
||||||
|
// Later Windows versions use the A record format below for AAAA records.
|
||||||
|
if (stripos($line, "$host AAAA IPv6 address") === 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// No break
|
||||||
|
|
||||||
|
case 'A':
|
||||||
if (!empty($host_matches))
|
if (!empty($host_matches))
|
||||||
{
|
{
|
||||||
// Second line
|
// Second line
|
||||||
|
@ -3760,10 +3812,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
|
|
||||||
// Try to not call the adm page data...
|
// Try to not call the adm page data...
|
||||||
|
|
||||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
echo '<!DOCTYPE html>';
|
||||||
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
|
echo '<html dir="ltr">';
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
echo '<meta charset="utf-8">';
|
||||||
echo '<title>' . $msg_title . '</title>';
|
echo '<title>' . $msg_title . '</title>';
|
||||||
echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
|
echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
|
||||||
echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
|
echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
|
||||||
|
|
|
@ -2596,6 +2596,31 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||||
$sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
|
$sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($log_count !== false)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT COUNT(l.log_id) AS total_entries
|
||||||
|
FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
|
||||||
|
WHERE l.log_type = $log_type
|
||||||
|
AND l.user_id = u.user_id
|
||||||
|
AND l.log_time >= $limit_days
|
||||||
|
$sql_keywords
|
||||||
|
$sql_forum";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$log_count = (int) $db->sql_fetchfield('total_entries');
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($log_count == 0)
|
||||||
|
{
|
||||||
|
// Save the queries, because there are no logs to display
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($offset >= $log_count)
|
||||||
|
{
|
||||||
|
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour
|
$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour
|
||||||
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
|
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
|
||||||
WHERE l.log_type = $log_type
|
WHERE l.log_type = $log_type
|
||||||
|
@ -2743,21 +2768,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($log_count !== false)
|
return $offset;
|
||||||
{
|
|
||||||
$sql = 'SELECT COUNT(l.log_id) AS total_entries
|
|
||||||
FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
|
|
||||||
WHERE l.log_type = $log_type
|
|
||||||
AND l.user_id = u.user_id
|
|
||||||
AND l.log_time >= $limit_days
|
|
||||||
$sql_keywords
|
|
||||||
$sql_forum";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$log_count = (int) $db->sql_fetchfield('total_entries');
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2889,6 +2900,12 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
|
||||||
$user_count = (int) $db->sql_fetchfield('user_count');
|
$user_count = (int) $db->sql_fetchfield('user_count');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($user_count == 0)
|
||||||
|
{
|
||||||
|
// Save the queries, because there are no users to display
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($offset >= $user_count)
|
if ($offset >= $user_count)
|
||||||
{
|
{
|
||||||
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
|
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
|
||||||
|
|
|
@ -691,6 +691,9 @@ function censor_text($text)
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip control characters
|
||||||
|
$text = preg_replace('/[\x00-\x0f]/', '', $text);
|
||||||
|
|
||||||
// We moved the word censor checks in here because we call this function quite often - and then only need to do the check once
|
// We moved the word censor checks in here because we call this function quite often - and then only need to do the check once
|
||||||
if (!isset($censors) || !is_array($censors))
|
if (!isset($censors) || !is_array($censors))
|
||||||
{
|
{
|
||||||
|
@ -1107,7 +1110,7 @@ function extension_allowed($forum_id, $extension, &$extensions)
|
||||||
* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
|
* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
|
||||||
* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
|
* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
|
||||||
* @param bool $allow_reply Allow Re: in front of string
|
* @param bool $allow_reply Allow Re: in front of string
|
||||||
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_legnth) and is deprecated.
|
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated.
|
||||||
* @param string $append String to be appended
|
* @param string $append String to be appended
|
||||||
*/
|
*/
|
||||||
function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
|
function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ function display_user_activity(&$userdata)
|
||||||
/**
|
/**
|
||||||
* Topic and forum watching common code
|
* Topic and forum watching common code
|
||||||
*/
|
*/
|
||||||
function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0)
|
function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '')
|
||||||
{
|
{
|
||||||
global $template, $db, $user, $phpEx, $start, $phpbb_root_path;
|
global $template, $db, $user, $phpEx, $start, $phpbb_root_path;
|
||||||
global $request;
|
global $request;
|
||||||
|
@ -1070,32 +1070,46 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
|
|
||||||
if (!is_null($notify_status) && $notify_status !== '')
|
if (!is_null($notify_status) && $notify_status !== '')
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isset($_GET['unwatch']))
|
if (isset($_GET['unwatch']))
|
||||||
{
|
{
|
||||||
$uid = request_var('uid', 0);
|
$uid = request_var('uid', 0);
|
||||||
if ($uid != $user_id)
|
$token = request_var('hash', '');
|
||||||
|
|
||||||
|
if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true))
|
||||||
{
|
{
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
if (($uid != $user_id) || ($request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode))
|
||||||
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
{
|
||||||
trigger_error($message);
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
}
|
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
if ($request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode)
|
trigger_error($message);
|
||||||
{
|
}
|
||||||
$is_watching = 0;
|
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $table_sql . "
|
$sql = 'DELETE FROM ' . $table_sql . "
|
||||||
WHERE $where_sql = $match_id
|
WHERE $where_sql = $match_id
|
||||||
AND user_id = $user_id";
|
AND user_id = $user_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
|
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
meta_refresh(3, $redirect_url);
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$s_hidden_fields = array(
|
||||||
|
'uid' => $user->data['user_id'],
|
||||||
|
'unwatch' => $mode,
|
||||||
|
'start' => $start,
|
||||||
|
'f' => $forum_id,
|
||||||
|
);
|
||||||
|
if ($mode != 'forum')
|
||||||
|
{
|
||||||
|
$s_hidden_fields['t'] = $topic_id;
|
||||||
|
}
|
||||||
|
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
$confirm_box_message = (($item_title == '') ? 'UNWATCH_' . strtoupper($mode) : $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title));
|
||||||
|
confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields));
|
||||||
meta_refresh(3, $redirect_url);
|
}
|
||||||
|
|
||||||
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1115,26 +1129,45 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
{
|
{
|
||||||
if (isset($_GET['watch']))
|
if (isset($_GET['watch']))
|
||||||
{
|
{
|
||||||
|
$uid = request_var('uid', 0);
|
||||||
$token = request_var('hash', '');
|
$token = request_var('hash', '');
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
|
||||||
|
|
||||||
if ($request->variable('watch', '', false, phpbb_request_interface::GET) == $mode && check_link_hash($token, "{$mode}_$match_id"))
|
if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true))
|
||||||
{
|
{
|
||||||
|
if (($uid != $user_id) || ($request->variable('watch', '', false, phpbb_request_interface::GET) != $mode))
|
||||||
|
{
|
||||||
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
|
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
trigger_error($message);
|
||||||
|
}
|
||||||
|
|
||||||
$is_watching = true;
|
$is_watching = true;
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
|
$sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status)
|
||||||
VALUES ($user_id, $match_id, " . NOTIFY_YES . ')';
|
VALUES ($user_id, $match_id, " . NOTIFY_YES . ')';
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
meta_refresh(3, $redirect_url);
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
$s_hidden_fields = array(
|
||||||
|
'uid' => $user->data['user_id'],
|
||||||
|
'watch' => $mode,
|
||||||
|
'start' => $start,
|
||||||
|
'f' => $forum_id,
|
||||||
|
);
|
||||||
|
if ($mode != 'forum')
|
||||||
|
{
|
||||||
|
$s_hidden_fields['t'] = $topic_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$confirm_box_message = (($item_title == '') ? 'WATCH_' . strtoupper($mode) : $user->lang('WATCH_' . strtoupper($mode) . '_DETAILED', $item_title));
|
||||||
|
confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields));
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_refresh(3, $redirect_url);
|
|
||||||
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1144,7 +1177,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode)
|
if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode) ||
|
||||||
|
(isset($_GET['watch']) && $request->variable('watch', '', false, phpbb_request_interface::GET) == $mode))
|
||||||
{
|
{
|
||||||
login_box();
|
login_box();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,10 +100,10 @@ function send_avatar_to_browser($file, $browser)
|
||||||
*/
|
*/
|
||||||
function wrap_img_in_html($src, $title)
|
function wrap_img_in_html($src, $title)
|
||||||
{
|
{
|
||||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd">';
|
echo '<!DOCTYPE html>';
|
||||||
echo '<html>';
|
echo '<html>';
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
|
echo '<meta charset="utf-8">';
|
||||||
echo '<title>' . $title . '</title>';
|
echo '<title>' . $title . '</title>';
|
||||||
echo '</head>';
|
echo '</head>';
|
||||||
echo '<body>';
|
echo '<body>';
|
||||||
|
|
|
@ -175,7 +175,7 @@ class messenger
|
||||||
*/
|
*/
|
||||||
function template($template_file, $template_lang = '', $template_path = '')
|
function template($template_file, $template_lang = '', $template_path = '')
|
||||||
{
|
{
|
||||||
global $config, $phpbb_root_path, $user;
|
global $config, $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
if (!trim($template_file))
|
if (!trim($template_file))
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,8 @@ class messenger
|
||||||
// tpl_msg now holds a template object we can use to parse the template file
|
// tpl_msg now holds a template object we can use to parse the template file
|
||||||
if (!isset($this->tpl_msg[$template_lang . $template_file]))
|
if (!isset($this->tpl_msg[$template_lang . $template_file]))
|
||||||
{
|
{
|
||||||
$this->tpl_msg[$template_lang . $template_file] = new template();
|
$template_locator = new phpbb_template_locator();
|
||||||
|
$this->tpl_msg[$template_lang . $template_file] = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
|
||||||
$tpl = &$this->tpl_msg[$template_lang . $template_file];
|
$tpl = &$this->tpl_msg[$template_lang . $template_file];
|
||||||
|
|
||||||
$fallback_template_path = false;
|
$fallback_template_path = false;
|
||||||
|
|
|
@ -1078,7 +1078,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row =& $rowset[$post_list[$i]];
|
$row = $rowset[$post_list[$i]];
|
||||||
|
|
||||||
$poster_id = $row['user_id'];
|
$poster_id = $row['user_id'];
|
||||||
$post_subject = $row['post_subject'];
|
$post_subject = $row['post_subject'];
|
||||||
|
|
|
@ -1,812 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extension of template class - Functions needed for compiling templates only.
|
|
||||||
*
|
|
||||||
* psoTFX, phpBB Development Team - Completion of file caching, decompilation
|
|
||||||
* routines and implementation of conditionals/keywords and associated changes
|
|
||||||
*
|
|
||||||
* The interface was inspired by PHPLib templates, and the template file (formats are
|
|
||||||
* quite similar)
|
|
||||||
*
|
|
||||||
* The keyword/conditional implementation is currently based on sections of code from
|
|
||||||
* the Smarty templating engine (c) 2001 ispi of Lincoln, Inc. which is released
|
|
||||||
* (on its own and in whole) under the LGPL. Section 3 of the LGPL states that any code
|
|
||||||
* derived from an LGPL application may be relicenced under the GPL, this applies
|
|
||||||
* to this source
|
|
||||||
*
|
|
||||||
* DEFINE directive inspired by a request by Cyberalien
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class template_compile
|
|
||||||
{
|
|
||||||
var $template;
|
|
||||||
|
|
||||||
// Various storage arrays
|
|
||||||
var $block_names = array();
|
|
||||||
var $block_else_level = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constuctor
|
|
||||||
*/
|
|
||||||
function template_compile(&$template)
|
|
||||||
{
|
|
||||||
$this->template = &$template;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load template source from file
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _tpl_load_file($handle, $store_in_db = false)
|
|
||||||
{
|
|
||||||
// Try and open template for read
|
|
||||||
if (!file_exists($this->template->files[$handle]))
|
|
||||||
{
|
|
||||||
trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->template->compiled_code[$handle] = $this->compile(trim(@file_get_contents($this->template->files[$handle])));
|
|
||||||
|
|
||||||
// Actually compile the code now.
|
|
||||||
$this->compile_write($handle, $this->template->compiled_code[$handle]);
|
|
||||||
|
|
||||||
// Store in database if required...
|
|
||||||
if ($store_in_db)
|
|
||||||
{
|
|
||||||
global $db, $user;
|
|
||||||
|
|
||||||
$sql_ary = array(
|
|
||||||
'template_id' => $this->template->files_template[$handle],
|
|
||||||
'template_filename' => $this->template->filename[$handle],
|
|
||||||
'template_included' => '',
|
|
||||||
'template_mtime' => time(),
|
|
||||||
'template_data' => trim(@file_get_contents($this->template->files[$handle])),
|
|
||||||
);
|
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . STYLES_TEMPLATE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove any PHP tags that do not belong, these regular expressions are derived from
|
|
||||||
* the ones that exist in zend_language_scanner.l
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function remove_php_tags(&$code)
|
|
||||||
{
|
|
||||||
// This matches the information gathered from the internal PHP lexer
|
|
||||||
$match = array(
|
|
||||||
'#<([\?%])=?.*?\1>#s',
|
|
||||||
'#<script\s+language\s*=\s*(["\']?)php\1\s*>.*?</script\s*>#s',
|
|
||||||
'#<\?php(?:\r\n?|[ \n\t]).*?\?>#s'
|
|
||||||
);
|
|
||||||
|
|
||||||
$code = preg_replace($match, '', $code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The all seeing all doing compile method. Parts are inspired by or directly from Smarty
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile($code, $no_echo = false, $echo_var = '')
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
if ($echo_var)
|
|
||||||
{
|
|
||||||
global $$echo_var;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove any "loose" php ... we want to give admins the ability
|
|
||||||
// to switch on/off PHP for a given template. Allowing unchecked
|
|
||||||
// php is a no-no. There is a potential issue here in that non-php
|
|
||||||
// content may be removed ... however designers should use entities
|
|
||||||
// if they wish to display < and >
|
|
||||||
$this->remove_php_tags($code);
|
|
||||||
|
|
||||||
// Pull out all block/statement level elements and separate plain text
|
|
||||||
preg_match_all('#<!-- PHP -->(.*?)<!-- ENDPHP -->#s', $code, $matches);
|
|
||||||
$php_blocks = $matches[1];
|
|
||||||
$code = preg_replace('#<!-- PHP -->.*?<!-- ENDPHP -->#s', '<!-- PHP -->', $code);
|
|
||||||
|
|
||||||
preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
|
|
||||||
$include_blocks = $matches[1];
|
|
||||||
$code = preg_replace('#<!-- INCLUDE (?:\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', '<!-- INCLUDE -->', $code);
|
|
||||||
|
|
||||||
preg_match_all('#<!-- INCLUDEPHP ([a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
|
|
||||||
$includephp_blocks = $matches[1];
|
|
||||||
$code = preg_replace('#<!-- INCLUDEPHP [a-zA-Z0-9\_\-\+\./]+ -->#', '<!-- INCLUDEPHP -->', $code);
|
|
||||||
|
|
||||||
preg_match_all('#<!-- ([^<].*?) (.*?)? ?-->#', $code, $blocks, PREG_SET_ORDER);
|
|
||||||
|
|
||||||
$text_blocks = preg_split('#<!-- [^<].*? (?:.*?)? ?-->#', $code);
|
|
||||||
|
|
||||||
for ($i = 0, $j = sizeof($text_blocks); $i < $j; $i++)
|
|
||||||
{
|
|
||||||
$this->compile_var_tags($text_blocks[$i]);
|
|
||||||
}
|
|
||||||
$compile_blocks = array();
|
|
||||||
|
|
||||||
for ($curr_tb = 0, $tb_size = sizeof($blocks); $curr_tb < $tb_size; $curr_tb++)
|
|
||||||
{
|
|
||||||
$block_val = &$blocks[$curr_tb];
|
|
||||||
|
|
||||||
switch ($block_val[1])
|
|
||||||
{
|
|
||||||
case 'BEGIN':
|
|
||||||
$this->block_else_level[] = false;
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_block($block_val[2]) . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'BEGINELSE':
|
|
||||||
$this->block_else_level[sizeof($this->block_else_level) - 1] = true;
|
|
||||||
$compile_blocks[] = '<?php }} else { ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'END':
|
|
||||||
array_pop($this->block_names);
|
|
||||||
$compile_blocks[] = '<?php ' . ((array_pop($this->block_else_level)) ? '}' : '}}') . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'IF':
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], false) . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ELSE':
|
|
||||||
$compile_blocks[] = '<?php } else { ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ELSEIF':
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_if($block_val[2], true) . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ENDIF':
|
|
||||||
$compile_blocks[] = '<?php } ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'DEFINE':
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], true) . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'UNDEFINE':
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], false) . ' ?>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'INCLUDE':
|
|
||||||
$temp = array_shift($include_blocks);
|
|
||||||
|
|
||||||
// Dynamic includes
|
|
||||||
// Cheap match rather than a full blown regexp, we already know
|
|
||||||
// the format of the input so just use string manipulation.
|
|
||||||
if ($temp[0] == '{')
|
|
||||||
{
|
|
||||||
$file = false;
|
|
||||||
|
|
||||||
if ($temp[1] == '$')
|
|
||||||
{
|
|
||||||
$var = substr($temp, 2, -1);
|
|
||||||
//$file = $this->template->_tpldata['DEFINE']['.'][$var];
|
|
||||||
$temp = "\$this->_tpldata['DEFINE']['.']['$var']";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$var = substr($temp, 1, -1);
|
|
||||||
//$file = $this->template->_rootref[$var];
|
|
||||||
$temp = "\$this->_rootref['$var']";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$file = $temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile_blocks[] = '<?php ' . $this->compile_tag_include($temp) . ' ?>';
|
|
||||||
|
|
||||||
// No point in checking variable includes
|
|
||||||
if ($file)
|
|
||||||
{
|
|
||||||
$this->template->_tpl_include($file, false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'INCLUDEPHP':
|
|
||||||
$compile_blocks[] = ($config['tpl_allow_php']) ? '<?php ' . $this->compile_tag_include_php(array_shift($includephp_blocks)) . ' ?>' : '';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PHP':
|
|
||||||
$compile_blocks[] = ($config['tpl_allow_php']) ? '<?php ' . array_shift($php_blocks) . ' ?>' : '';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$this->compile_var_tags($block_val[0]);
|
|
||||||
$trim_check = trim($block_val[0]);
|
|
||||||
$compile_blocks[] = (!$no_echo) ? ((!empty($trim_check)) ? $block_val[0] : '') : ((!empty($trim_check)) ? $block_val[0] : '');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$template_php = '';
|
|
||||||
for ($i = 0, $size = sizeof($text_blocks); $i < $size; $i++)
|
|
||||||
{
|
|
||||||
$trim_check_text = trim($text_blocks[$i]);
|
|
||||||
$template_php .= (!$no_echo) ? (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '') : (($trim_check_text != '') ? $text_blocks[$i] : '') . ((isset($compile_blocks[$i])) ? $compile_blocks[$i] : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove unused opening/closing tags
|
|
||||||
$template_php = str_replace(' ?><?php ', ' ', $template_php);
|
|
||||||
|
|
||||||
// Now add a newline after each php closing tag which already has a newline
|
|
||||||
// PHP itself strips a newline if a closing tag is used (this is documented behaviour) and it is mostly not intended by style authors to remove newlines
|
|
||||||
$template_php = preg_replace('#\?\>([\r\n])#', '?>\1\1', $template_php);
|
|
||||||
|
|
||||||
// There will be a number of occasions where we switch into and out of
|
|
||||||
// PHP mode instantaneously. Rather than "burden" the parser with this
|
|
||||||
// we'll strip out such occurences, minimising such switching
|
|
||||||
if ($no_echo)
|
|
||||||
{
|
|
||||||
return "\$$echo_var .= '" . $template_php . "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $template_php;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile variables
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_var_tags(&$text_blocks)
|
|
||||||
{
|
|
||||||
// change template varrefs into PHP varrefs
|
|
||||||
$varrefs = array();
|
|
||||||
|
|
||||||
// This one will handle varrefs WITH namespaces
|
|
||||||
preg_match_all('#\{((?:[a-z0-9\-_]+\.)+)(\$)?([A-Z0-9\-_]+)\}#', $text_blocks, $varrefs, PREG_SET_ORDER);
|
|
||||||
|
|
||||||
foreach ($varrefs as $var_val)
|
|
||||||
{
|
|
||||||
$namespace = $var_val[1];
|
|
||||||
$varname = $var_val[3];
|
|
||||||
$new = $this->generate_block_varref($namespace, $varname, true, $var_val[2]);
|
|
||||||
|
|
||||||
$text_blocks = str_replace($var_val[0], $new, $text_blocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will handle the remaining root-level varrefs
|
|
||||||
// transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array
|
|
||||||
if (strpos($text_blocks, '{L_') !== false)
|
|
||||||
{
|
|
||||||
$text_blocks = preg_replace('#\{L_([A-Z0-9\-_]+)\}#', "<?php echo ((isset(\$this->_rootref['L_\\1'])) ? \$this->_rootref['L_\\1'] : ((isset(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '{ \\1 }')); ?>", $text_blocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle addslashed language variables prefixed with LA_
|
|
||||||
// If a template variable already exist, it will be used in favor of it...
|
|
||||||
if (strpos($text_blocks, '{LA_') !== false)
|
|
||||||
{
|
|
||||||
$text_blocks = preg_replace('#\{LA_([A-Z0-9\-_]+)\}#', "<?php echo ((isset(\$this->_rootref['LA_\\1'])) ? \$this->_rootref['LA_\\1'] : ((isset(\$this->_rootref['L_\\1'])) ? addslashes(\$this->_rootref['L_\\1']) : ((isset(\$user->lang['\\1'])) ? addslashes(\$user->lang['\\1']) : '{ \\1 }'))); ?>", $text_blocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle remaining varrefs
|
|
||||||
$text_blocks = preg_replace('#\{([A-Z0-9\-_]+)\}#', "<?php echo (isset(\$this->_rootref['\\1'])) ? \$this->_rootref['\\1'] : ''; ?>", $text_blocks);
|
|
||||||
$text_blocks = preg_replace('#\{\$([A-Z0-9\-_]+)\}#', "<?php echo (isset(\$this->_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile blocks
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_tag_block($tag_args)
|
|
||||||
{
|
|
||||||
$no_nesting = false;
|
|
||||||
|
|
||||||
// Is the designer wanting to call another loop in a loop?
|
|
||||||
if (strpos($tag_args, '!') === 0)
|
|
||||||
{
|
|
||||||
// Count the number of ! occurrences (not allowed in vars)
|
|
||||||
$no_nesting = substr_count($tag_args, '!');
|
|
||||||
$tag_args = substr($tag_args, $no_nesting);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow for control of looping (indexes start from zero):
|
|
||||||
// foo(2) : Will start the loop on the 3rd entry
|
|
||||||
// foo(-2) : Will start the loop two entries from the end
|
|
||||||
// foo(3,4) : Will start the loop on the fourth entry and end it on the fifth
|
|
||||||
// foo(3,-4) : Will start the loop on the fourth entry and end it four from last
|
|
||||||
if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match))
|
|
||||||
{
|
|
||||||
$tag_args = $match[1];
|
|
||||||
|
|
||||||
if ($match[2] < 0)
|
|
||||||
{
|
|
||||||
$loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($match[3]) < 1 || $match[3] == -1)
|
|
||||||
{
|
|
||||||
$loop_end = '$_' . $tag_args . '_count';
|
|
||||||
}
|
|
||||||
else if ($match[3] >= 0)
|
|
||||||
{
|
|
||||||
$loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
|
|
||||||
}
|
|
||||||
else //if ($match[3] < -1)
|
|
||||||
{
|
|
||||||
$loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$loop_start = 0;
|
|
||||||
$loop_end = '$_' . $tag_args . '_count';
|
|
||||||
}
|
|
||||||
|
|
||||||
$tag_template_php = '';
|
|
||||||
array_push($this->block_names, $tag_args);
|
|
||||||
|
|
||||||
if ($no_nesting !== false)
|
|
||||||
{
|
|
||||||
// We need to implode $no_nesting times from the end...
|
|
||||||
$block = array_slice($this->block_names, -$no_nesting);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$block = $this->block_names;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($block) < 2)
|
|
||||||
{
|
|
||||||
// Block is not nested.
|
|
||||||
$tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
|
|
||||||
$varref = "\$this->_tpldata['$tag_args']";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This block is nested.
|
|
||||||
// Generate a namespace string for this block.
|
|
||||||
$namespace = implode('.', $block);
|
|
||||||
|
|
||||||
// Get a reference to the data array for this block that depends on the
|
|
||||||
// current indices of all parent blocks.
|
|
||||||
$varref = $this->generate_block_data_ref($namespace, false);
|
|
||||||
|
|
||||||
// Create the for loop code to iterate over this block.
|
|
||||||
$tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
|
|
||||||
}
|
|
||||||
|
|
||||||
$tag_template_php .= 'if ($_' . $tag_args . '_count) {';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
|
|
||||||
* <code>
|
|
||||||
* if (!$offset)
|
|
||||||
* {
|
|
||||||
* $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
|
|
||||||
* }
|
|
||||||
* </code>
|
|
||||||
*/
|
|
||||||
|
|
||||||
$tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
|
|
||||||
$tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
|
|
||||||
|
|
||||||
return $tag_template_php;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile IF tags - much of this is from Smarty with
|
|
||||||
* some adaptions for our block level methods
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_tag_if($tag_args, $elseif)
|
|
||||||
{
|
|
||||||
// Tokenize args for 'if' tag.
|
|
||||||
preg_match_all('/(?:
|
|
||||||
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
|
|
||||||
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
|
|
||||||
[(),] |
|
|
||||||
[^\s(),]+)/x', $tag_args, $match);
|
|
||||||
|
|
||||||
$tokens = $match[0];
|
|
||||||
$is_arg_stack = array();
|
|
||||||
|
|
||||||
for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
|
|
||||||
{
|
|
||||||
$token = &$tokens[$i];
|
|
||||||
|
|
||||||
switch ($token)
|
|
||||||
{
|
|
||||||
case '!==':
|
|
||||||
case '===':
|
|
||||||
case '<<':
|
|
||||||
case '>>':
|
|
||||||
case '|':
|
|
||||||
case '^':
|
|
||||||
case '&':
|
|
||||||
case '~':
|
|
||||||
case ')':
|
|
||||||
case ',':
|
|
||||||
case '+':
|
|
||||||
case '-':
|
|
||||||
case '*':
|
|
||||||
case '/':
|
|
||||||
case '@':
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '==':
|
|
||||||
case 'eq':
|
|
||||||
$token = '==';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '!=':
|
|
||||||
case '<>':
|
|
||||||
case 'ne':
|
|
||||||
case 'neq':
|
|
||||||
$token = '!=';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '<':
|
|
||||||
case 'lt':
|
|
||||||
$token = '<';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '<=':
|
|
||||||
case 'le':
|
|
||||||
case 'lte':
|
|
||||||
$token = '<=';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '>':
|
|
||||||
case 'gt':
|
|
||||||
$token = '>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '>=':
|
|
||||||
case 'ge':
|
|
||||||
case 'gte':
|
|
||||||
$token = '>=';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '&&':
|
|
||||||
case 'and':
|
|
||||||
$token = '&&';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '||':
|
|
||||||
case 'or':
|
|
||||||
$token = '||';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '!':
|
|
||||||
case 'not':
|
|
||||||
$token = '!';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '%':
|
|
||||||
case 'mod':
|
|
||||||
$token = '%';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '(':
|
|
||||||
array_push($is_arg_stack, $i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'is':
|
|
||||||
$is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
|
|
||||||
$is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
|
|
||||||
|
|
||||||
$new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
|
|
||||||
|
|
||||||
array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
|
|
||||||
|
|
||||||
$i = $is_arg_start;
|
|
||||||
|
|
||||||
// no break
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs))
|
|
||||||
{
|
|
||||||
$token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
|
|
||||||
}
|
|
||||||
else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
|
|
||||||
{
|
|
||||||
// Allow checking if loops are set with .loopname
|
|
||||||
// It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
|
|
||||||
$blocks = explode('.', $varrefs[1]);
|
|
||||||
|
|
||||||
// If the block is nested, we have a reference that we can grab.
|
|
||||||
// If the block is not nested, we just go and grab the block from _tpldata
|
|
||||||
if (sizeof($blocks) > 1)
|
|
||||||
{
|
|
||||||
$block = array_pop($blocks);
|
|
||||||
$namespace = implode('.', $blocks);
|
|
||||||
$varref = $this->generate_block_data_ref($namespace, true);
|
|
||||||
|
|
||||||
// Add the block reference for the last child.
|
|
||||||
$varref .= "['" . $block . "']";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$varref = '$this->_tpldata';
|
|
||||||
|
|
||||||
// Add the block reference for the last child.
|
|
||||||
$varref .= "['" . $blocks[0] . "']";
|
|
||||||
}
|
|
||||||
$token = "sizeof($varref)";
|
|
||||||
}
|
|
||||||
else if (!empty($token))
|
|
||||||
{
|
|
||||||
$token = '(' . $token . ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are no valid tokens left or only control/compare characters left, we do skip this statement
|
|
||||||
if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '')
|
|
||||||
{
|
|
||||||
$tokens = array('false');
|
|
||||||
}
|
|
||||||
return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile DEFINE tags
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_tag_define($tag_args, $op)
|
|
||||||
{
|
|
||||||
preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
|
|
||||||
|
|
||||||
if (empty($match[2]) || (!isset($match[4]) && $op))
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$op)
|
|
||||||
{
|
|
||||||
return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Are we a string?
|
|
||||||
if ($match[3] && $match[5])
|
|
||||||
{
|
|
||||||
$match[4] = str_replace(array('\\\'', '\\\\', '\''), array('\'', '\\', '\\\''), $match[4]);
|
|
||||||
|
|
||||||
// Compile reference, we allow template variables in defines...
|
|
||||||
$match[4] = $this->compile($match[4]);
|
|
||||||
|
|
||||||
// Now replace the php code
|
|
||||||
$match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
preg_match('#true|false|\.#i', $match[4], $type);
|
|
||||||
|
|
||||||
switch (strtolower($type[0]))
|
|
||||||
{
|
|
||||||
case 'true':
|
|
||||||
case 'false':
|
|
||||||
$match[4] = strtoupper($match[4]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '.':
|
|
||||||
$match[4] = doubleval($match[4]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$match[4] = intval($match[4]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile INCLUDE tag
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_tag_include($tag_args)
|
|
||||||
{
|
|
||||||
// Process dynamic includes
|
|
||||||
if ($tag_args[0] == '$')
|
|
||||||
{
|
|
||||||
return "if (isset($tag_args)) { \$this->_tpl_include($tag_args); }";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "\$this->_tpl_include('$tag_args');";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile INCLUDE_PHP tag
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_tag_include_php($tag_args)
|
|
||||||
{
|
|
||||||
return "\$this->_php_include('$tag_args');";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse expression
|
|
||||||
* This is from Smarty
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _parse_is_expr($is_arg, $tokens)
|
|
||||||
{
|
|
||||||
$expr_end = 0;
|
|
||||||
$negate_expr = false;
|
|
||||||
|
|
||||||
if (($first_token = array_shift($tokens)) == 'not')
|
|
||||||
{
|
|
||||||
$negate_expr = true;
|
|
||||||
$expr_type = array_shift($tokens);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$expr_type = $first_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($expr_type)
|
|
||||||
{
|
|
||||||
case 'even':
|
|
||||||
if (@$tokens[$expr_end] == 'by')
|
|
||||||
{
|
|
||||||
$expr_end++;
|
|
||||||
$expr_arg = $tokens[$expr_end++];
|
|
||||||
$expr = "!(($is_arg / $expr_arg) % $expr_arg)";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$expr = "!($is_arg & 1)";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'odd':
|
|
||||||
if (@$tokens[$expr_end] == 'by')
|
|
||||||
{
|
|
||||||
$expr_end++;
|
|
||||||
$expr_arg = $tokens[$expr_end++];
|
|
||||||
$expr = "(($is_arg / $expr_arg) % $expr_arg)";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$expr = "($is_arg & 1)";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'div':
|
|
||||||
if (@$tokens[$expr_end] == 'by')
|
|
||||||
{
|
|
||||||
$expr_end++;
|
|
||||||
$expr_arg = $tokens[$expr_end++];
|
|
||||||
$expr = "!($is_arg % $expr_arg)";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($negate_expr)
|
|
||||||
{
|
|
||||||
$expr = "!($expr)";
|
|
||||||
}
|
|
||||||
|
|
||||||
array_splice($tokens, 0, $expr_end, $expr);
|
|
||||||
|
|
||||||
return $tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a reference to the given variable inside the given (possibly nested)
|
|
||||||
* block namespace. This is a string of the form:
|
|
||||||
* ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
|
|
||||||
* It's ready to be inserted into an "echo" line in one of the templates.
|
|
||||||
* NOTE: expects a trailing "." on the namespace.
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
|
|
||||||
{
|
|
||||||
// Strip the trailing period.
|
|
||||||
$namespace = substr($namespace, 0, -1);
|
|
||||||
|
|
||||||
// Get a reference to the data block for this namespace.
|
|
||||||
$varref = $this->generate_block_data_ref($namespace, true, $defop);
|
|
||||||
// Prepend the necessary code to stick this in an echo line.
|
|
||||||
|
|
||||||
// Append the variable reference.
|
|
||||||
$varref .= "['$varname']";
|
|
||||||
$varref = ($echo) ? "<?php echo $varref; ?>" : ((isset($varref)) ? $varref : '');
|
|
||||||
|
|
||||||
return $varref;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a reference to the array of data values for the given
|
|
||||||
* (possibly nested) block namespace. This is a string of the form:
|
|
||||||
* $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
|
|
||||||
*
|
|
||||||
* If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
|
|
||||||
* NOTE: does not expect a trailing "." on the blockname.
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
|
|
||||||
{
|
|
||||||
// Get an array of the blocks involved.
|
|
||||||
$blocks = explode('.', $blockname);
|
|
||||||
$blockcount = sizeof($blocks) - 1;
|
|
||||||
|
|
||||||
// DEFINE is not an element of any referenced variable, we must use _tpldata to access it
|
|
||||||
if ($defop)
|
|
||||||
{
|
|
||||||
$varref = '$this->_tpldata[\'DEFINE\']';
|
|
||||||
// Build up the string with everything but the last child.
|
|
||||||
for ($i = 0; $i < $blockcount; $i++)
|
|
||||||
{
|
|
||||||
$varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
|
|
||||||
}
|
|
||||||
// Add the block reference for the last child.
|
|
||||||
$varref .= "['" . $blocks[$blockcount] . "']";
|
|
||||||
// Add the iterator for the last child if requried.
|
|
||||||
if ($include_last_iterator)
|
|
||||||
{
|
|
||||||
$varref .= '[$_' . $blocks[$blockcount] . '_i]';
|
|
||||||
}
|
|
||||||
return $varref;
|
|
||||||
}
|
|
||||||
else if ($include_last_iterator)
|
|
||||||
{
|
|
||||||
return '$_'. $blocks[$blockcount] . '_val';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write compiled file to cache directory
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function compile_write($handle, $data)
|
|
||||||
{
|
|
||||||
global $phpEx;
|
|
||||||
|
|
||||||
$filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . '.' . $phpEx;
|
|
||||||
|
|
||||||
$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
|
|
||||||
|
|
||||||
if ($fp = @fopen($filename, 'wb'))
|
|
||||||
{
|
|
||||||
@flock($fp, LOCK_EX);
|
|
||||||
@fwrite ($fp, $data);
|
|
||||||
@flock($fp, LOCK_UN);
|
|
||||||
@fclose($fp);
|
|
||||||
|
|
||||||
phpbb_chmod($filename, CHMOD_READ | CHMOD_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -808,23 +808,56 @@ class ftp_fsock extends transfer
|
||||||
*/
|
*/
|
||||||
function _open_data_connection()
|
function _open_data_connection()
|
||||||
{
|
{
|
||||||
$this->_send_command('PASV', '', false);
|
// Try to find out whether we have a IPv4 or IPv6 (control) connection
|
||||||
|
if (function_exists('stream_socket_get_name'))
|
||||||
if (!$ip_port = $this->_check_command(true))
|
|
||||||
{
|
{
|
||||||
return false;
|
$socket_name = stream_socket_get_name($this->connection, true);
|
||||||
|
$server_ip = substr($socket_name, 0, strrpos($socket_name, ':'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the connection to start sending the file
|
if (!isset($server_ip) || preg_match(get_preg_expression('ipv4'), $server_ip))
|
||||||
if (!preg_match('#[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+#', $ip_port, $temp))
|
|
||||||
{
|
{
|
||||||
// bad ip and port
|
// Passive mode
|
||||||
return false;
|
$this->_send_command('PASV', '', false);
|
||||||
|
|
||||||
|
if (!$ip_port = $this->_check_command(true))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open the connection to start sending the file
|
||||||
|
if (!preg_match('#[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+#', $ip_port, $temp))
|
||||||
|
{
|
||||||
|
// bad ip and port
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp = explode(',', $temp[0]);
|
||||||
|
$server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3];
|
||||||
|
$server_port = $temp[4] * 256 + $temp[5];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Extended Passive Mode - RFC2428
|
||||||
|
$this->_send_command('EPSV', '', false);
|
||||||
|
|
||||||
|
if (!$epsv_response = $this->_check_command(true))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response looks like "229 Entering Extended Passive Mode (|||12345|)"
|
||||||
|
// where 12345 is the tcp port for the data connection
|
||||||
|
if (!preg_match('#\(\|\|\|([0-9]+)\|\)#', $epsv_response, $match))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$server_port = (int) $match[1];
|
||||||
|
|
||||||
|
// fsockopen expects IPv6 address in square brackets
|
||||||
|
$server_ip = "[$server_ip]";
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = explode(',', $temp[0]);
|
|
||||||
$server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3];
|
|
||||||
$server_port = $temp[4] * 256 + $temp[5];
|
|
||||||
$errno = 0;
|
$errno = 0;
|
||||||
$errstr = '';
|
$errstr = '';
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class mcp_logs
|
||||||
// Grab log data
|
// Grab log data
|
||||||
$log_data = array();
|
$log_data = array();
|
||||||
$log_count = 0;
|
$log_count = 0;
|
||||||
view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
|
$start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start),
|
'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start),
|
||||||
|
@ -179,7 +179,7 @@ class mcp_logs
|
||||||
|
|
||||||
'L_TITLE' => $user->lang['MCP_LOGS'],
|
'L_TITLE' => $user->lang['MCP_LOGS'],
|
||||||
|
|
||||||
'U_POST_ACTION' => $this->u_action,
|
'U_POST_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
|
||||||
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
|
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
|
||||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||||
|
|
|
@ -198,7 +198,7 @@ class mcp_notes
|
||||||
|
|
||||||
$log_data = array();
|
$log_data = array();
|
||||||
$log_count = 0;
|
$log_count = 0;
|
||||||
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords);
|
$start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords);
|
||||||
|
|
||||||
if ($log_count)
|
if ($log_count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,690 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @version $Id$
|
|
||||||
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base Template class.
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class template
|
|
||||||
{
|
|
||||||
/** variable that holds all the data we'll be substituting into
|
|
||||||
* the compiled templates. Takes form:
|
|
||||||
* --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
|
|
||||||
* if it's a root-level variable, it'll be like this:
|
|
||||||
* --> $this->_tpldata[.][0][varname] == value
|
|
||||||
*/
|
|
||||||
var $_tpldata = array('.' => array(0 => array()));
|
|
||||||
var $_rootref;
|
|
||||||
|
|
||||||
// Root dir and hash of filenames for each template handle.
|
|
||||||
var $root = '';
|
|
||||||
var $cachepath = '';
|
|
||||||
var $files = array();
|
|
||||||
var $filename = array();
|
|
||||||
var $files_inherit = array();
|
|
||||||
var $files_template = array();
|
|
||||||
var $inherit_root = '';
|
|
||||||
var $orig_tpl_storedb;
|
|
||||||
var $orig_tpl_inherits_id;
|
|
||||||
|
|
||||||
// this will hash handle names to the compiled/uncompiled code for that handle.
|
|
||||||
var $compiled_code = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set template location
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function set_template()
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $user;
|
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
|
|
||||||
{
|
|
||||||
$this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
|
|
||||||
$this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_';
|
|
||||||
|
|
||||||
if ($this->orig_tpl_storedb === null)
|
|
||||||
{
|
|
||||||
$this->orig_tpl_storedb = $user->theme['template_storedb'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->orig_tpl_inherits_id === null)
|
|
||||||
{
|
|
||||||
$this->orig_tpl_inherits_id = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->theme['template_storedb'] = $this->orig_tpl_storedb;
|
|
||||||
$user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
|
|
||||||
|
|
||||||
if ($user->theme['template_inherits_id'])
|
|
||||||
{
|
|
||||||
$this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_rootref = &$this->_tpldata['.'][0];
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set custom template location (able to use directory outside of phpBB)
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function set_custom_template($template_path, $template_name, $fallback_template_path = false)
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $user;
|
|
||||||
|
|
||||||
// Make sure $template_path has no ending slash
|
|
||||||
if (substr($template_path, -1) == '/')
|
|
||||||
{
|
|
||||||
$template_path = substr($template_path, 0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->root = $template_path;
|
|
||||||
$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
|
|
||||||
|
|
||||||
if ($fallback_template_path !== false)
|
|
||||||
{
|
|
||||||
if (substr($fallback_template_path, -1) == '/')
|
|
||||||
{
|
|
||||||
$fallback_template_path = substr($fallback_template_path, 0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->inherit_root = $fallback_template_path;
|
|
||||||
$this->orig_tpl_inherits_id = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->orig_tpl_inherits_id = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the database does not store the path or name of a custom template
|
|
||||||
// so there is no way we can properly store custom templates there
|
|
||||||
$this->orig_tpl_storedb = false;
|
|
||||||
|
|
||||||
$this->_rootref = &$this->_tpldata['.'][0];
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the template filenames for handles. $filename_array
|
|
||||||
* should be a hash of handle => filename pairs.
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function set_filenames($filename_array)
|
|
||||||
{
|
|
||||||
if (!is_array($filename_array))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
foreach ($filename_array as $handle => $filename)
|
|
||||||
{
|
|
||||||
if (empty($filename))
|
|
||||||
{
|
|
||||||
trigger_error("template->set_filenames: Empty filename specified for $handle", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->filename[$handle] = $filename;
|
|
||||||
$this->files[$handle] = $this->root . '/' . $filename;
|
|
||||||
|
|
||||||
if ($this->inherit_root)
|
|
||||||
{
|
|
||||||
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy template data set
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function destroy()
|
|
||||||
{
|
|
||||||
$this->_tpldata = array('.' => array(0 => array()));
|
|
||||||
$this->_rootref = &$this->_tpldata['.'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset/empty complete block
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function destroy_block_vars($blockname)
|
|
||||||
{
|
|
||||||
if (strpos($blockname, '.') !== false)
|
|
||||||
{
|
|
||||||
// Nested block.
|
|
||||||
$blocks = explode('.', $blockname);
|
|
||||||
$blockcount = sizeof($blocks) - 1;
|
|
||||||
|
|
||||||
$str = &$this->_tpldata;
|
|
||||||
for ($i = 0; $i < $blockcount; $i++)
|
|
||||||
{
|
|
||||||
$str = &$str[$blocks[$i]];
|
|
||||||
$str = &$str[sizeof($str) - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($str[$blocks[$blockcount]]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Top-level block.
|
|
||||||
unset($this->_tpldata[$blockname]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display handle
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function display($handle, $include_once = true)
|
|
||||||
{
|
|
||||||
global $user, $phpbb_hook;
|
|
||||||
|
|
||||||
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))
|
|
||||||
{
|
|
||||||
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
|
||||||
{
|
|
||||||
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defined('IN_ERROR_HANDLER'))
|
|
||||||
{
|
|
||||||
if ((E_NOTICE & error_reporting()) == E_NOTICE)
|
|
||||||
{
|
|
||||||
error_reporting(error_reporting() ^ E_NOTICE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filename = $this->_tpl_load($handle))
|
|
||||||
{
|
|
||||||
($include_once) ? include_once($filename) : include($filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the handle and assign the output to a template variable or return the compiled result.
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
|
|
||||||
{
|
|
||||||
ob_start();
|
|
||||||
$this->display($handle, $include_once);
|
|
||||||
$contents = ob_get_clean();
|
|
||||||
|
|
||||||
if ($return_content)
|
|
||||||
{
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assign_var($template_var, $contents);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load a compiled template if possible, if not, recompile it
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _tpl_load(&$handle)
|
|
||||||
{
|
|
||||||
global $user, $phpEx, $config;
|
|
||||||
|
|
||||||
if (!isset($this->filename[$handle]))
|
|
||||||
{
|
|
||||||
trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reload these settings to have the values they had when this object was initialised
|
|
||||||
// using set_template or set_custom_template, they might otherwise have been overwritten
|
|
||||||
// by other template class instances in between.
|
|
||||||
$user->theme['template_storedb'] = $this->orig_tpl_storedb;
|
|
||||||
$user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
|
|
||||||
|
|
||||||
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx;
|
|
||||||
$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
|
|
||||||
|
|
||||||
$recompile = false;
|
|
||||||
if (!file_exists($filename) || @filesize($filename) === 0 || defined('DEBUG_EXTRA'))
|
|
||||||
{
|
|
||||||
$recompile = true;
|
|
||||||
}
|
|
||||||
else if ($config['load_tplcompile'])
|
|
||||||
{
|
|
||||||
// No way around it: we need to check inheritance here
|
|
||||||
if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
|
|
||||||
{
|
|
||||||
$this->files[$handle] = $this->files_inherit[$handle];
|
|
||||||
$this->files_template[$handle] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
$recompile = (@filemtime($filename) < filemtime($this->files[$handle])) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recompile page if the original template is newer, otherwise load the compiled version
|
|
||||||
if (!$recompile)
|
|
||||||
{
|
|
||||||
return $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
global $db, $phpbb_root_path;
|
|
||||||
|
|
||||||
if (!class_exists('template_compile'))
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'includes/functions_template.' . $phpEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inheritance - we point to another template file for this one. Equality is also used for store_db
|
|
||||||
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
|
|
||||||
{
|
|
||||||
$this->files[$handle] = $this->files_inherit[$handle];
|
|
||||||
$this->files_template[$handle] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile = new template_compile($this);
|
|
||||||
|
|
||||||
// If we don't have a file assigned to this handle, die.
|
|
||||||
if (!isset($this->files[$handle]))
|
|
||||||
{
|
|
||||||
trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just compile if no user object is present (happens within the installer)
|
|
||||||
if (!$user)
|
|
||||||
{
|
|
||||||
$compile->_tpl_load_file($handle);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($user->theme['template_storedb']) && $user->theme['template_storedb'])
|
|
||||||
{
|
|
||||||
$rows = array();
|
|
||||||
$ids = array();
|
|
||||||
// Inheritance
|
|
||||||
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
|
|
||||||
{
|
|
||||||
$ids[] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
$ids[] = $user->theme['template_id'];
|
|
||||||
|
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
|
|
||||||
WHERE template_id = ' . $id . "
|
|
||||||
AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "'
|
|
||||||
OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')';
|
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$rows[$row['template_filename']] = $row;
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sizeof($rows))
|
|
||||||
{
|
|
||||||
foreach ($rows as $row)
|
|
||||||
{
|
|
||||||
$file = $this->root . '/' . $row['template_filename'];
|
|
||||||
$force_reload = false;
|
|
||||||
if ($row['template_id'] != $user->theme['template_id'])
|
|
||||||
{
|
|
||||||
// make sure that we are not overlooking a file not in the db yet
|
|
||||||
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
|
|
||||||
{
|
|
||||||
$file = $this->inherit_root . '/' . $row['template_filename'];
|
|
||||||
$this->files[$row['template_filename']] = $file;
|
|
||||||
$this->files_inherit[$row['template_filename']] = $file;
|
|
||||||
$this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
|
|
||||||
{
|
|
||||||
// Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that.
|
|
||||||
$force_reload = true;
|
|
||||||
$this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->files_template[$row['template_filename']] = $user->theme['template_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($force_reload || $row['template_mtime'] < filemtime($file))
|
|
||||||
{
|
|
||||||
if ($row['template_filename'] == $this->filename[$handle])
|
|
||||||
{
|
|
||||||
$compile->_tpl_load_file($handle, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->files[$row['template_filename']] = $file;
|
|
||||||
$this->filename[$row['template_filename']] = $row['template_filename'];
|
|
||||||
$compile->_tpl_load_file($row['template_filename'], true);
|
|
||||||
unset($this->compiled_code[$row['template_filename']]);
|
|
||||||
unset($this->files[$row['template_filename']]);
|
|
||||||
unset($this->filename[$row['template_filename']]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row['template_filename'] == $this->filename[$handle])
|
|
||||||
{
|
|
||||||
$this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
|
|
||||||
$compile->compile_write($handle, $this->compiled_code[$handle]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Only bother compiling if it doesn't already exist
|
|
||||||
if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx))
|
|
||||||
{
|
|
||||||
$this->filename[$row['template_filename']] = $row['template_filename'];
|
|
||||||
$compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data'])));
|
|
||||||
unset($this->filename[$row['template_filename']]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$file = $this->root . '/' . $row['template_filename'];
|
|
||||||
|
|
||||||
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
|
|
||||||
{
|
|
||||||
$file = $this->inherit_root . '/' . $row['template_filename'];
|
|
||||||
$this->files[$row['template_filename']] = $file;
|
|
||||||
$this->files_inherit[$row['template_filename']] = $file;
|
|
||||||
$this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
|
|
||||||
}
|
|
||||||
// Try to load from filesystem and instruct to insert into the styles table...
|
|
||||||
$compile->_tpl_load_file($handle, true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile->_tpl_load_file($handle);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assign key variable pairs from an array
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function assign_vars($vararray)
|
|
||||||
{
|
|
||||||
foreach ($vararray as $key => $val)
|
|
||||||
{
|
|
||||||
$this->_rootref[$key] = $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assign a single variable to a single key
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function assign_var($varname, $varval)
|
|
||||||
{
|
|
||||||
$this->_rootref[$varname] = $varval;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assign key variable pairs from an array to a specified block
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function assign_block_vars($blockname, $vararray)
|
|
||||||
{
|
|
||||||
if (strpos($blockname, '.') !== false)
|
|
||||||
{
|
|
||||||
// Nested block.
|
|
||||||
$blocks = explode('.', $blockname);
|
|
||||||
$blockcount = sizeof($blocks) - 1;
|
|
||||||
|
|
||||||
$str = &$this->_tpldata;
|
|
||||||
for ($i = 0; $i < $blockcount; $i++)
|
|
||||||
{
|
|
||||||
$str = &$str[$blocks[$i]];
|
|
||||||
$str = &$str[sizeof($str) - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
|
|
||||||
$vararray['S_ROW_COUNT'] = $s_row_count;
|
|
||||||
|
|
||||||
// Assign S_FIRST_ROW
|
|
||||||
if (!$s_row_count)
|
|
||||||
{
|
|
||||||
$vararray['S_FIRST_ROW'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now the tricky part, we always assign S_LAST_ROW and remove the entry before
|
|
||||||
// This is much more clever than going through the complete template data on display (phew)
|
|
||||||
$vararray['S_LAST_ROW'] = true;
|
|
||||||
if ($s_row_count > 0)
|
|
||||||
{
|
|
||||||
unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we add the block that we're actually assigning to.
|
|
||||||
// We're adding a new iteration to this block with the given
|
|
||||||
// variable assignments.
|
|
||||||
$str[$blocks[$blockcount]][] = $vararray;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Top-level block.
|
|
||||||
$s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
|
|
||||||
$vararray['S_ROW_COUNT'] = $s_row_count;
|
|
||||||
|
|
||||||
// Assign S_FIRST_ROW
|
|
||||||
if (!$s_row_count)
|
|
||||||
{
|
|
||||||
$vararray['S_FIRST_ROW'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We always assign S_LAST_ROW and remove the entry before
|
|
||||||
$vararray['S_LAST_ROW'] = true;
|
|
||||||
if ($s_row_count > 0)
|
|
||||||
{
|
|
||||||
unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a new iteration to this block with the variable assignments we were given.
|
|
||||||
$this->_tpldata[$blockname][] = $vararray;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
|
||||||
*
|
|
||||||
* An example of how to use this function:
|
|
||||||
* {@example alter_block_array.php}
|
|
||||||
*
|
|
||||||
* @param string $blockname the blockname, for example 'loop'
|
|
||||||
* @param array $vararray the var array to insert/add or merge
|
|
||||||
* @param mixed $key Key to search for
|
|
||||||
*
|
|
||||||
* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
|
|
||||||
*
|
|
||||||
* int: Position [the position to change or insert at directly given]
|
|
||||||
*
|
|
||||||
* If key is false the position is set to 0
|
|
||||||
* If key is true the position is set to the last entry
|
|
||||||
*
|
|
||||||
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
|
|
||||||
*
|
|
||||||
* If insert, the vararray is inserted at the given position (position counting from zero).
|
|
||||||
* If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
|
|
||||||
*
|
|
||||||
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
|
|
||||||
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
|
|
||||||
*
|
|
||||||
* @return bool false on error, true on success
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
|
|
||||||
{
|
|
||||||
if (strpos($blockname, '.') !== false)
|
|
||||||
{
|
|
||||||
// Nested blocks are not supported
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change key to zero (change first position) if false and to last position if true
|
|
||||||
if ($key === false || $key === true)
|
|
||||||
{
|
|
||||||
$key = ($key === false) ? 0 : sizeof($this->_tpldata[$blockname]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get correct position if array given
|
|
||||||
if (is_array($key))
|
|
||||||
{
|
|
||||||
// Search array to get correct position
|
|
||||||
list($search_key, $search_value) = @each($key);
|
|
||||||
|
|
||||||
$key = NULL;
|
|
||||||
foreach ($this->_tpldata[$blockname] as $i => $val_ary)
|
|
||||||
{
|
|
||||||
if ($val_ary[$search_key] === $search_value)
|
|
||||||
{
|
|
||||||
$key = $i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// key/value pair not found
|
|
||||||
if ($key === NULL)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert Block
|
|
||||||
if ($mode == 'insert')
|
|
||||||
{
|
|
||||||
// Make sure we are not exceeding the last iteration
|
|
||||||
if ($key >= sizeof($this->_tpldata[$blockname]))
|
|
||||||
{
|
|
||||||
$key = sizeof($this->_tpldata[$blockname]);
|
|
||||||
unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
|
|
||||||
$vararray['S_LAST_ROW'] = true;
|
|
||||||
}
|
|
||||||
else if ($key === 0)
|
|
||||||
{
|
|
||||||
unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
|
|
||||||
$vararray['S_FIRST_ROW'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-position template blocks
|
|
||||||
for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
|
|
||||||
{
|
|
||||||
$this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
|
|
||||||
$this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert vararray at given position
|
|
||||||
$vararray['S_ROW_COUNT'] = $key;
|
|
||||||
$this->_tpldata[$blockname][$key] = $vararray;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Which block to change?
|
|
||||||
if ($mode == 'change')
|
|
||||||
{
|
|
||||||
if ($key == sizeof($this->_tpldata[$blockname]))
|
|
||||||
{
|
|
||||||
$key--;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_tpldata[$blockname][$key] = array_merge($this->_tpldata[$blockname][$key], $vararray);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Include a separate template
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _tpl_include($filename, $include = true)
|
|
||||||
{
|
|
||||||
$handle = $filename;
|
|
||||||
$this->filename[$handle] = $filename;
|
|
||||||
$this->files[$handle] = $this->root . '/' . $filename;
|
|
||||||
if ($this->inherit_root)
|
|
||||||
{
|
|
||||||
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
$filename = $this->_tpl_load($handle);
|
|
||||||
|
|
||||||
if ($include)
|
|
||||||
{
|
|
||||||
global $user;
|
|
||||||
|
|
||||||
if ($filename)
|
|
||||||
{
|
|
||||||
include($filename);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Include a php-file
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function _php_include($filename)
|
|
||||||
{
|
|
||||||
global $phpbb_root_path;
|
|
||||||
|
|
||||||
$file = $phpbb_root_path . $filename;
|
|
||||||
|
|
||||||
if (!file_exists($file))
|
|
||||||
{
|
|
||||||
// trigger_error cannot be used here, as the output already started
|
|
||||||
echo 'template->_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
include($file);
|
|
||||||
}
|
|
||||||
}
|
|
122
phpBB/includes/template/compile.php
Normal file
122
phpBB/includes/template/compile.php
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2005 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream_filter_register('phpbb_template', 'phpbb_template_filter');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of template class - Functions needed for compiling templates only.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
||||||
|
*/
|
||||||
|
class phpbb_template_compile
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Whether <!-- PHP --> tags are allowed
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $allow_php;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
|
||||||
|
*/
|
||||||
|
public function __construct($allow_php)
|
||||||
|
{
|
||||||
|
$this->allow_php = $allow_php;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiles template in $source_file and writes compiled template to
|
||||||
|
* cache directory
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle to compile
|
||||||
|
* @param string $source_file Source template file
|
||||||
|
* @return bool Return true on success otherwise false
|
||||||
|
*/
|
||||||
|
public function compile_file_to_file($source_file, $compiled_file)
|
||||||
|
{
|
||||||
|
$source_handle = @fopen($source_file, 'rb');
|
||||||
|
$destination_handle = @fopen($compiled_file, 'wb');
|
||||||
|
|
||||||
|
if (!$source_handle || !$destination_handle)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@flock($destination_handle, LOCK_EX);
|
||||||
|
|
||||||
|
$this->compile_stream_to_stream($source_handle, $destination_handle);
|
||||||
|
|
||||||
|
@fclose($source_handle);
|
||||||
|
@flock($destination_handle, LOCK_UN);
|
||||||
|
@fclose($destination_handle);
|
||||||
|
|
||||||
|
phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE);
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiles a template located at $source_file.
|
||||||
|
*
|
||||||
|
* Returns PHP source suitable for eval().
|
||||||
|
*
|
||||||
|
* @param string $source_file Source template file
|
||||||
|
* @return string|bool Return compiled code on successful compilation otherwise false
|
||||||
|
*/
|
||||||
|
public function compile_file($source_file)
|
||||||
|
{
|
||||||
|
$source_handle = @fopen($source_file, 'rb');
|
||||||
|
$destination_handle = @fopen('php://temp' ,'r+b');
|
||||||
|
|
||||||
|
if (!$source_handle || !$destination_handle)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->compile_stream_to_stream($source_handle, $destination_handle);
|
||||||
|
|
||||||
|
@fclose($source_handle);
|
||||||
|
|
||||||
|
rewind($destination_handle);
|
||||||
|
$contents = stream_get_contents($destination_handle);
|
||||||
|
@fclose($dest_handle);
|
||||||
|
|
||||||
|
return $contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiles contents of $source_stream into $dest_stream.
|
||||||
|
*
|
||||||
|
* A stream filter is appended to $source_stream as part of the
|
||||||
|
* process.
|
||||||
|
*
|
||||||
|
* @param resource $source_stream Source stream
|
||||||
|
* @param resource $dest_stream Destination stream
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
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_copy_to_stream($source_stream, $dest_stream);
|
||||||
|
}
|
||||||
|
}
|
342
phpBB/includes/template/context.php
Normal file
342
phpBB/includes/template/context.php
Normal file
|
@ -0,0 +1,342 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores variables assigned to template.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template_context
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* variable that holds all the data we'll be substituting into
|
||||||
|
* the compiled templates. Takes form:
|
||||||
|
* --> $this->tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
|
||||||
|
* if it's a root-level variable, it'll be like this:
|
||||||
|
* --> $this->tpldata[.][0][varname] == value
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $tpldata = array('.' => array(0 => array()));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Reference to template->tpldata['.'][0]
|
||||||
|
*/
|
||||||
|
private $rootref;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears template data set.
|
||||||
|
*/
|
||||||
|
public function clear()
|
||||||
|
{
|
||||||
|
$this->tpldata = array('.' => array(0 => array()));
|
||||||
|
$this->rootref = &$this->tpldata['.'][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign a single variable to a single key
|
||||||
|
*
|
||||||
|
* @param string $varname Variable name
|
||||||
|
* @param string $varval Value to assign to variable
|
||||||
|
*/
|
||||||
|
public function assign_var($varname, $varval)
|
||||||
|
{
|
||||||
|
$this->rootref[$varname] = $varval;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a reference to template data array.
|
||||||
|
*
|
||||||
|
* This function is public so that template renderer may invoke it.
|
||||||
|
* Users should alter template variables via functions in phpbb_template.
|
||||||
|
*
|
||||||
|
* Note: modifying returned array will affect data stored in the context.
|
||||||
|
*
|
||||||
|
* @return array template data
|
||||||
|
*/
|
||||||
|
public function &get_data_ref()
|
||||||
|
{
|
||||||
|
// returning a reference directly is not
|
||||||
|
// something php is capable of doing
|
||||||
|
$ref = &$this->tpldata;
|
||||||
|
return $ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a reference to template root scope.
|
||||||
|
*
|
||||||
|
* This function is public so that template renderer may invoke it.
|
||||||
|
* Users should not need to invoke this function.
|
||||||
|
*
|
||||||
|
* Note: modifying returned array will affect data stored in the context.
|
||||||
|
*
|
||||||
|
* @return array template data
|
||||||
|
*/
|
||||||
|
public function &get_root_ref()
|
||||||
|
{
|
||||||
|
// rootref is already a reference
|
||||||
|
return $this->rootref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign key variable pairs from an array to a specified block
|
||||||
|
*
|
||||||
|
* @param string $blockname Name of block to assign $vararray to
|
||||||
|
* @param array $vararray A hash of variable name => value pairs
|
||||||
|
*/
|
||||||
|
public function assign_block_vars($blockname, array $vararray)
|
||||||
|
{
|
||||||
|
if (strpos($blockname, '.') !== false)
|
||||||
|
{
|
||||||
|
// Nested block.
|
||||||
|
$blocks = explode('.', $blockname);
|
||||||
|
$blockcount = sizeof($blocks) - 1;
|
||||||
|
|
||||||
|
$str = &$this->tpldata;
|
||||||
|
for ($i = 0; $i < $blockcount; $i++)
|
||||||
|
{
|
||||||
|
$str = &$str[$blocks[$i]];
|
||||||
|
$str = &$str[sizeof($str) - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0;
|
||||||
|
$vararray['S_ROW_COUNT'] = $s_row_count;
|
||||||
|
|
||||||
|
// Assign S_FIRST_ROW
|
||||||
|
if (!$s_row_count)
|
||||||
|
{
|
||||||
|
$vararray['S_FIRST_ROW'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now the tricky part, we always assign S_LAST_ROW and remove the entry before
|
||||||
|
// This is much more clever than going through the complete template data on display (phew)
|
||||||
|
$vararray['S_LAST_ROW'] = true;
|
||||||
|
if ($s_row_count > 0)
|
||||||
|
{
|
||||||
|
unset($str[$blocks[$blockcount]][($s_row_count - 1)]['S_LAST_ROW']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we add the block that we're actually assigning to.
|
||||||
|
// We're adding a new iteration to this block with the given
|
||||||
|
// variable assignments.
|
||||||
|
$str[$blocks[$blockcount]][] = $vararray;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Top-level block.
|
||||||
|
$s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0;
|
||||||
|
$vararray['S_ROW_COUNT'] = $s_row_count;
|
||||||
|
|
||||||
|
// Assign S_FIRST_ROW
|
||||||
|
if (!$s_row_count)
|
||||||
|
{
|
||||||
|
$vararray['S_FIRST_ROW'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We always assign S_LAST_ROW and remove the entry before
|
||||||
|
$vararray['S_LAST_ROW'] = true;
|
||||||
|
if ($s_row_count > 0)
|
||||||
|
{
|
||||||
|
unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a new iteration to this block with the variable assignments we were given.
|
||||||
|
$this->tpldata[$blockname][] = $vararray;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
||||||
|
*
|
||||||
|
* An example of how to use this function:
|
||||||
|
* {@example alter_block_array.php}
|
||||||
|
*
|
||||||
|
* @param string $blockname the blockname, for example 'loop'
|
||||||
|
* @param array $vararray the var array to insert/add or merge
|
||||||
|
* @param mixed $key Key to search for
|
||||||
|
*
|
||||||
|
* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
|
||||||
|
*
|
||||||
|
* int: Position [the position to change or insert at directly given]
|
||||||
|
*
|
||||||
|
* If key is false the position is set to 0
|
||||||
|
* If key is true the position is set to the last entry
|
||||||
|
*
|
||||||
|
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
|
||||||
|
*
|
||||||
|
* If insert, the vararray is inserted at the given position (position counting from zero).
|
||||||
|
* If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
|
||||||
|
*
|
||||||
|
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
|
||||||
|
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
|
||||||
|
*
|
||||||
|
* @return bool false on error, true on success
|
||||||
|
*/
|
||||||
|
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
|
||||||
|
{
|
||||||
|
if (strpos($blockname, '.') !== false)
|
||||||
|
{
|
||||||
|
// Nested block.
|
||||||
|
$blocks = explode('.', $blockname);
|
||||||
|
$blockcount = sizeof($blocks) - 1;
|
||||||
|
|
||||||
|
$block = &$this->tpldata;
|
||||||
|
for ($i = 0; $i < $blockcount; $i++)
|
||||||
|
{
|
||||||
|
if (($pos = strpos($blocks[$i], '[')) !== false)
|
||||||
|
{
|
||||||
|
$name = substr($blocks[$i], 0, $pos);
|
||||||
|
|
||||||
|
if (strpos($blocks[$i], '[]') === $pos)
|
||||||
|
{
|
||||||
|
$index = sizeof($block[$name]) - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$name = $blocks[$i];
|
||||||
|
$index = sizeof($block[$name]) - 1;
|
||||||
|
}
|
||||||
|
$block = &$block[$name];
|
||||||
|
$block = &$block[$index];
|
||||||
|
}
|
||||||
|
|
||||||
|
$block = &$block[$blocks[$i]]; // Traverse the last block
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Top-level block.
|
||||||
|
$block = &$this->tpldata[$blockname];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change key to zero (change first position) if false and to last position if true
|
||||||
|
if ($key === false || $key === true)
|
||||||
|
{
|
||||||
|
$key = ($key === false) ? 0 : sizeof($block);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get correct position if array given
|
||||||
|
if (is_array($key))
|
||||||
|
{
|
||||||
|
// Search array to get correct position
|
||||||
|
list($search_key, $search_value) = @each($key);
|
||||||
|
|
||||||
|
$key = NULL;
|
||||||
|
foreach ($block as $i => $val_ary)
|
||||||
|
{
|
||||||
|
if ($val_ary[$search_key] === $search_value)
|
||||||
|
{
|
||||||
|
$key = $i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// key/value pair not found
|
||||||
|
if ($key === NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert Block
|
||||||
|
if ($mode == 'insert')
|
||||||
|
{
|
||||||
|
// Make sure we are not exceeding the last iteration
|
||||||
|
if ($key >= sizeof($this->tpldata[$blockname]))
|
||||||
|
{
|
||||||
|
$key = sizeof($this->tpldata[$blockname]);
|
||||||
|
unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
|
||||||
|
$vararray['S_LAST_ROW'] = true;
|
||||||
|
}
|
||||||
|
else if ($key === 0)
|
||||||
|
{
|
||||||
|
unset($this->tpldata[$blockname][0]['S_FIRST_ROW']);
|
||||||
|
$vararray['S_FIRST_ROW'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-position template blocks
|
||||||
|
for ($i = sizeof($block); $i > $key; $i--)
|
||||||
|
{
|
||||||
|
$block[$i] = $block[$i-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert vararray at given position
|
||||||
|
$block[$key] = $vararray;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Which block to change?
|
||||||
|
if ($mode == 'change')
|
||||||
|
{
|
||||||
|
if ($key == sizeof($block))
|
||||||
|
{
|
||||||
|
$key--;
|
||||||
|
}
|
||||||
|
|
||||||
|
$block[$key] = array_merge($block[$key], $vararray);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset/empty complete block
|
||||||
|
*
|
||||||
|
* @param string $blockname Name of block to destroy
|
||||||
|
*/
|
||||||
|
public function destroy_block_vars($blockname)
|
||||||
|
{
|
||||||
|
if (strpos($blockname, '.') !== false)
|
||||||
|
{
|
||||||
|
// Nested block.
|
||||||
|
$blocks = explode('.', $blockname);
|
||||||
|
$blockcount = sizeof($blocks) - 1;
|
||||||
|
|
||||||
|
$str = &$this->tpldata;
|
||||||
|
for ($i = 0; $i < $blockcount; $i++)
|
||||||
|
{
|
||||||
|
$str = &$str[$blocks[$i]];
|
||||||
|
$str = &$str[sizeof($str) - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($str[$blocks[$blockcount]]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Top-level block.
|
||||||
|
unset($this->tpldata[$blockname]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
923
phpBB/includes/template/filter.php
Normal file
923
phpBB/includes/template/filter.php
Normal file
|
@ -0,0 +1,923 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The template filter that does the actual compilation
|
||||||
|
*
|
||||||
|
* psoTFX, phpBB Development Team - Completion of file caching, decompilation
|
||||||
|
* routines and implementation of conditionals/keywords and associated changes
|
||||||
|
*
|
||||||
|
* The interface was inspired by PHPLib templates, and the template file (formats are
|
||||||
|
* quite similar)
|
||||||
|
*
|
||||||
|
* The keyword/conditional implementation is currently based on sections of code from
|
||||||
|
* the Smarty templating engine (c) 2001 ispi of Lincoln, Inc. which is released
|
||||||
|
* (on its own and in whole) under the LGPL. Section 3 of the LGPL states that any code
|
||||||
|
* derived from an LGPL application may be relicenced under the GPL, this applies
|
||||||
|
* to this source
|
||||||
|
*
|
||||||
|
* DEFINE directive inspired by a request by Cyberalien
|
||||||
|
*
|
||||||
|
* @see template_compile
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template_filter extends php_user_filter
|
||||||
|
{
|
||||||
|
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
||||||
|
|
||||||
|
const REGEX_VAR = '[A-Z_][A-Z_0-9]+';
|
||||||
|
|
||||||
|
const REGEX_TAG = '<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->';
|
||||||
|
|
||||||
|
const REGEX_TOKENS = '~<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->|{((?:[a-z_][a-z_0-9]+\.)*\\$?[A-Z][A-Z_0-9]+)}~';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $block_names = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $block_else_level = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $chunk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $in_php;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether inline PHP code, <!-- PHP --> and <!-- INCLUDEPHP --> tags
|
||||||
|
* are allowed. If this is false all PHP code will be silently
|
||||||
|
* removed from the template during compilation.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $allow_php;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream filter
|
||||||
|
*
|
||||||
|
* Is invoked for evey chunk of the stream, allowing us
|
||||||
|
* to work on a chunk at a time, which saves memory.
|
||||||
|
*/
|
||||||
|
public function filter($in, $out, &$consumed, $closing)
|
||||||
|
{
|
||||||
|
$written = false;
|
||||||
|
$first = false;
|
||||||
|
|
||||||
|
while ($bucket = stream_bucket_make_writeable($in))
|
||||||
|
{
|
||||||
|
$consumed += $bucket->datalen;
|
||||||
|
|
||||||
|
$data = $this->chunk . $bucket->data;
|
||||||
|
$last_nl = strrpos($data, "\n");
|
||||||
|
$this->chunk = substr($data, $last_nl);
|
||||||
|
$data = substr($data, 0, $last_nl);
|
||||||
|
|
||||||
|
if (!strlen($data))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$written = true;
|
||||||
|
|
||||||
|
$data = $this->compile($data);
|
||||||
|
if (!$first)
|
||||||
|
{
|
||||||
|
$data = $this->prepend_preamble($data);
|
||||||
|
$first = false;
|
||||||
|
}
|
||||||
|
$bucket->data = $data;
|
||||||
|
$bucket->datalen = strlen($bucket->data);
|
||||||
|
stream_bucket_append($out, $bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($closing && strlen($this->chunk))
|
||||||
|
{
|
||||||
|
$written = true;
|
||||||
|
$bucket = stream_bucket_new($this->stream, $this->compile($this->chunk));
|
||||||
|
stream_bucket_append($out, $bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $written ? PSFS_PASS_ON : PSFS_FEED_ME;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializer, called on creation.
|
||||||
|
*
|
||||||
|
* Get the allow_php option from params, which is passed
|
||||||
|
* to stream_filter_append.
|
||||||
|
*/
|
||||||
|
public function onCreate()
|
||||||
|
{
|
||||||
|
$this->chunk = '';
|
||||||
|
$this->in_php = false;
|
||||||
|
$this->allow_php = $this->params['allow_php'];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiles a chunk of template.
|
||||||
|
*
|
||||||
|
* The chunk must comprise of one or more complete lines from the source
|
||||||
|
* template.
|
||||||
|
*
|
||||||
|
* @param string $data Chunk of source template to compile
|
||||||
|
* @return string Compiled PHP/HTML code
|
||||||
|
*/
|
||||||
|
private function compile($data)
|
||||||
|
{
|
||||||
|
$block_start_in_php = $this->in_php;
|
||||||
|
|
||||||
|
$data = preg_replace('#<(?:[\\?%]|script)#s', '<?php echo\'\\0\';?>', $data);
|
||||||
|
$data = preg_replace_callback(self::REGEX_TOKENS, array($this, 'replace'), $data);
|
||||||
|
|
||||||
|
// Remove php
|
||||||
|
if (!$this->allow_php)
|
||||||
|
{
|
||||||
|
if ($block_start_in_php
|
||||||
|
&& $this->in_php
|
||||||
|
&& strpos($data, '<!-- PHP -->') === false
|
||||||
|
&& strpos($data, '<!-- ENDPHP -->') === false)
|
||||||
|
{
|
||||||
|
// This is just php code
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$data = preg_replace('~^.*?<!-- ENDPHP -->~', '', $data);
|
||||||
|
$data = preg_replace('~<!-- PHP -->.*?<!-- ENDPHP -->~', '', $data);
|
||||||
|
$data = preg_replace('~<!-- ENDPHP -->.*?$~', '', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Preserve whitespace.
|
||||||
|
PHP removes a newline after the closing tag (if it's there). This is by design.
|
||||||
|
|
||||||
|
|
||||||
|
Consider the following template:
|
||||||
|
|
||||||
|
<!-- IF condition -->
|
||||||
|
some content
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
If we were to simply preserve all whitespace, we could simply replace all "?>" tags
|
||||||
|
with "?>\n".
|
||||||
|
Doing that, would add additional newlines to the compiled tempalte in place of the
|
||||||
|
IF and ENDIF statements. These newlines are unwanted (and one is conditional).
|
||||||
|
The IF and ENDIF are usually on their own line for ease of reading.
|
||||||
|
|
||||||
|
This replacement preserves newlines only for statements that aren't the only statement on a line.
|
||||||
|
It will NOT preserve newlines at the end of statements in the above examle.
|
||||||
|
It will preserve newlines in situations like:
|
||||||
|
|
||||||
|
<!-- IF condition -->inline content<!-- ENDIF -->
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$data = preg_replace('~(?<!^)(<\?php(?:(?<!\?>).)+(?<!/\*\*/)\?>)$~m', "$1\n", $data);
|
||||||
|
$data = str_replace('/**/?>', "?>\n", $data);
|
||||||
|
$data = str_replace('?><?php', '', $data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepends a preamble to compiled template.
|
||||||
|
* Currently preamble checks if IN_PHPBB is defined and calls exit() if it is not.
|
||||||
|
*
|
||||||
|
* @param string $data Compiled template chunk
|
||||||
|
* @return string Compiled template chunk with preamble prepended
|
||||||
|
*/
|
||||||
|
private function prepend_preamble($data)
|
||||||
|
{
|
||||||
|
$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strncmp($data, '<?php', 5) === 0) ? substr($data, 5) : ' ?>' . $data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for replacing matched tokens with PHP code
|
||||||
|
*
|
||||||
|
* @param array $matches Regular expression matches
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function replace($matches)
|
||||||
|
{
|
||||||
|
if ($this->in_php && $matches[1] != 'ENDPHP')
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($matches[3]))
|
||||||
|
{
|
||||||
|
return $this->compile_var_tags($matches[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($matches[1])
|
||||||
|
{
|
||||||
|
case 'BEGIN':
|
||||||
|
$this->block_else_level[] = false;
|
||||||
|
return '<?php ' . $this->compile_tag_block($matches[2]) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'BEGINELSE':
|
||||||
|
$this->block_else_level[sizeof($this->block_else_level) - 1] = true;
|
||||||
|
return '<?php }} else { ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'END':
|
||||||
|
array_pop($this->block_names);
|
||||||
|
return '<?php ' . ((array_pop($this->block_else_level)) ? '}' : '}}') . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'IF':
|
||||||
|
return '<?php ' . $this->compile_tag_if($matches[2], false) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ELSE':
|
||||||
|
return '<?php } else { ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ELSEIF':
|
||||||
|
return '<?php ' . $this->compile_tag_if($matches[2], true) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ENDIF':
|
||||||
|
return '<?php } ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'DEFINE':
|
||||||
|
return '<?php ' . $this->compile_tag_define($matches[2], true) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'UNDEFINE':
|
||||||
|
return '<?php ' . $this->compile_tag_define($matches[2], false) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'INCLUDE':
|
||||||
|
return '<?php ' . $this->compile_tag_include($matches[2]) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'INCLUDEPHP':
|
||||||
|
return ($this->allow_php) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'PHP':
|
||||||
|
if ($this->allow_php)
|
||||||
|
{
|
||||||
|
$this->in_php = true;
|
||||||
|
return '<?php ';
|
||||||
|
}
|
||||||
|
return '<!-- PHP -->';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ENDPHP':
|
||||||
|
if ($this->allow_php)
|
||||||
|
{
|
||||||
|
$this->in_php = false;
|
||||||
|
return ' ?>';
|
||||||
|
}
|
||||||
|
return '<!-- ENDPHP -->';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return $matches[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile variables
|
||||||
|
*
|
||||||
|
* @param string $text_blocks Variable reference in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_var_tags(&$text_blocks)
|
||||||
|
{
|
||||||
|
// change template varrefs into PHP varrefs
|
||||||
|
$varrefs = array();
|
||||||
|
|
||||||
|
// This one will handle varrefs WITH namespaces
|
||||||
|
preg_match_all('#\{((?:' . self::REGEX_NS . '\.)+)(\$)?(' . self::REGEX_VAR . ')\}#', $text_blocks, $varrefs, PREG_SET_ORDER);
|
||||||
|
|
||||||
|
foreach ($varrefs as $var_val)
|
||||||
|
{
|
||||||
|
$namespace = $var_val[1];
|
||||||
|
$varname = $var_val[3];
|
||||||
|
$new = $this->generate_block_varref($namespace, $varname, true, $var_val[2]);
|
||||||
|
|
||||||
|
$text_blocks = str_replace($var_val[0], $new, $text_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle special language tags L_ and LA_
|
||||||
|
$this->compile_language_tags($text_blocks);
|
||||||
|
|
||||||
|
// This will handle the remaining root-level varrefs
|
||||||
|
$text_blocks = preg_replace('#\{(' . self::REGEX_VAR . ')\}#', "<?php echo (isset(\$_rootref['\\1'])) ? \$_rootref['\\1'] : ''; /**/?>", $text_blocks);
|
||||||
|
$text_blocks = preg_replace('#\{\$(' . self::REGEX_VAR . ')\}#', "<?php echo (isset(\$_tpldata['DEFINE']['.']['\\1'])) ? \$_tpldata['DEFINE']['.']['\\1'] : ''; /**/?>", $text_blocks);
|
||||||
|
|
||||||
|
return $text_blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles special language tags L_ and LA_
|
||||||
|
*
|
||||||
|
* @param string $text_blocks Variable reference in source template
|
||||||
|
*/
|
||||||
|
private function compile_language_tags(&$text_blocks)
|
||||||
|
{
|
||||||
|
// transform vars prefixed by L_ into their language variable pendant if nothing is set within the tpldata array
|
||||||
|
if (strpos($text_blocks, '{L_') !== false)
|
||||||
|
{
|
||||||
|
$text_blocks = preg_replace('#\{L_(' . self::REGEX_VAR . ')\}#', "<?php echo ((isset(\$_rootref['L_\\1'])) ? \$_rootref['L_\\1'] : ((isset(\$_lang['\\1'])) ? \$_lang['\\1'] : '{ \\1 }')); /**/?>", $text_blocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle addslashed language variables prefixed with LA_
|
||||||
|
// If a template variable already exist, it will be used in favor of it...
|
||||||
|
if (strpos($text_blocks, '{LA_') !== false)
|
||||||
|
{
|
||||||
|
$text_blocks = preg_replace('#\{LA_(' . self::REGEX_VAR . '+)\}#', "<?php echo ((isset(\$_rootref['LA_\\1'])) ? \$_rootref['LA_\\1'] : ((isset(\$_rootref['L_\\1'])) ? addslashes(\$_rootref['L_\\1']) : ((isset(\$_lang['\\1'])) ? addslashes(\$_lang['\\1']) : '{ \\1 }'))); /**/?>", $text_blocks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile blocks
|
||||||
|
*
|
||||||
|
* @param string $tag_args Block contents in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_block($tag_args)
|
||||||
|
{
|
||||||
|
$no_nesting = false;
|
||||||
|
|
||||||
|
// Is the designer wanting to call another loop in a loop?
|
||||||
|
// <!-- BEGIN loop -->
|
||||||
|
// <!-- BEGIN !loop2 -->
|
||||||
|
// <!-- END !loop2 -->
|
||||||
|
// <!-- END loop -->
|
||||||
|
// 'loop2' is actually on the same nesting level as 'loop' you assign
|
||||||
|
// variables to it with template->assign_block_vars('loop2', array(...))
|
||||||
|
if (strpos($tag_args, '!') === 0)
|
||||||
|
{
|
||||||
|
// Count the number if ! occurrences (not allowed in vars)
|
||||||
|
$no_nesting = substr_count($tag_args, '!');
|
||||||
|
$tag_args = substr($tag_args, $no_nesting);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow for control of looping (indexes start from zero):
|
||||||
|
// foo(2) : Will start the loop on the 3rd entry
|
||||||
|
// foo(-2) : Will start the loop two entries from the end
|
||||||
|
// foo(3,4) : Will start the loop on the fourth entry and end it on the fifth
|
||||||
|
// foo(3,-4) : Will start the loop on the fourth entry and end it four from last
|
||||||
|
$match = array();
|
||||||
|
|
||||||
|
if (preg_match('#^([^()]*)\(([\-\d]+)(?:,([\-\d]+))?\)$#', $tag_args, $match))
|
||||||
|
{
|
||||||
|
$tag_args = $match[1];
|
||||||
|
|
||||||
|
if ($match[2] < 0)
|
||||||
|
{
|
||||||
|
$loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($match[3]) || strlen($match[3]) < 1 || $match[3] == -1)
|
||||||
|
{
|
||||||
|
$loop_end = '$_' . $tag_args . '_count';
|
||||||
|
}
|
||||||
|
else if ($match[3] >= 0)
|
||||||
|
{
|
||||||
|
$loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
|
||||||
|
}
|
||||||
|
else //if ($match[3] < -1)
|
||||||
|
{
|
||||||
|
$loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$loop_start = 0;
|
||||||
|
$loop_end = '$_' . $tag_args . '_count';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tag_template_php = '';
|
||||||
|
array_push($this->block_names, $tag_args);
|
||||||
|
|
||||||
|
if ($no_nesting !== false)
|
||||||
|
{
|
||||||
|
// We need to implode $no_nesting times from the end...
|
||||||
|
$block = array_slice($this->block_names, -$no_nesting);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$block = $this->block_names;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($block) < 2)
|
||||||
|
{
|
||||||
|
// Block is not nested.
|
||||||
|
$tag_template_php = '$_' . $tag_args . "_count = (isset(\$_tpldata['$tag_args'])) ? sizeof(\$_tpldata['$tag_args']) : 0;";
|
||||||
|
$varref = "\$_tpldata['$tag_args']";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This block is nested.
|
||||||
|
// Generate a namespace string for this block.
|
||||||
|
$namespace = implode('.', $block);
|
||||||
|
|
||||||
|
// Get a reference to the data array for this block that depends on the
|
||||||
|
// current indices of all parent blocks.
|
||||||
|
$varref = $this->generate_block_data_ref($namespace, false);
|
||||||
|
|
||||||
|
// Create the for loop code to iterate over this block.
|
||||||
|
$tag_template_php = '$_' . $tag_args . '_count = (isset(' . $varref . ')) ? sizeof(' . $varref . ') : 0;';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tag_template_php .= 'if ($_' . $tag_args . '_count) {';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
|
||||||
|
* <code>
|
||||||
|
* if (!$offset)
|
||||||
|
* {
|
||||||
|
* $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
|
||||||
|
* }
|
||||||
|
* </code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
|
||||||
|
$tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
|
||||||
|
|
||||||
|
return $tag_template_php;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile a general expression - much of this is from Smarty with
|
||||||
|
* some adaptions for our block level methods
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression (tag arguments) in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_expression($tag_args)
|
||||||
|
{
|
||||||
|
$match = array();
|
||||||
|
preg_match_all('/(?:
|
||||||
|
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
|
||||||
|
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
|
||||||
|
[(),] |
|
||||||
|
[^\s(),]+)/x', $tag_args, $match);
|
||||||
|
|
||||||
|
$tokens = $match[0];
|
||||||
|
$is_arg_stack = array();
|
||||||
|
|
||||||
|
for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
|
||||||
|
{
|
||||||
|
$token = &$tokens[$i];
|
||||||
|
|
||||||
|
switch ($token)
|
||||||
|
{
|
||||||
|
case '!==':
|
||||||
|
case '===':
|
||||||
|
case '<<':
|
||||||
|
case '>>':
|
||||||
|
case '|':
|
||||||
|
case '^':
|
||||||
|
case '&':
|
||||||
|
case '~':
|
||||||
|
case ')':
|
||||||
|
case ',':
|
||||||
|
case '+':
|
||||||
|
case '-':
|
||||||
|
case '*':
|
||||||
|
case '/':
|
||||||
|
case '@':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '==':
|
||||||
|
case 'eq':
|
||||||
|
$token = '==';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '!=':
|
||||||
|
case '<>':
|
||||||
|
case 'ne':
|
||||||
|
case 'neq':
|
||||||
|
$token = '!=';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '<':
|
||||||
|
case 'lt':
|
||||||
|
$token = '<';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '<=':
|
||||||
|
case 'le':
|
||||||
|
case 'lte':
|
||||||
|
$token = '<=';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
case 'gt':
|
||||||
|
$token = '>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '>=':
|
||||||
|
case 'ge':
|
||||||
|
case 'gte':
|
||||||
|
$token = '>=';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '&&':
|
||||||
|
case 'and':
|
||||||
|
$token = '&&';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '||':
|
||||||
|
case 'or':
|
||||||
|
$token = '||';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '!':
|
||||||
|
case 'not':
|
||||||
|
$token = '!';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
case 'mod':
|
||||||
|
$token = '%';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '(':
|
||||||
|
array_push($is_arg_stack, $i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'is':
|
||||||
|
$is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
|
||||||
|
$is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
|
||||||
|
|
||||||
|
$new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
|
||||||
|
|
||||||
|
array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
|
||||||
|
|
||||||
|
$i = $is_arg_start;
|
||||||
|
|
||||||
|
// no break
|
||||||
|
|
||||||
|
default:
|
||||||
|
$varrefs = array();
|
||||||
|
if (preg_match('#^((?:' . self::REGEX_NS . '\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $token, $varrefs))
|
||||||
|
{
|
||||||
|
if (!empty($varrefs[1]))
|
||||||
|
{
|
||||||
|
$namespace = substr($varrefs[1], 0, -1);
|
||||||
|
$dot_pos = strrchr($namespace, '.');
|
||||||
|
if ($dot_pos !== false)
|
||||||
|
{
|
||||||
|
$namespace = substr($dot_pos, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// S_ROW_COUNT is deceptive, it returns the current row number not the number of rows
|
||||||
|
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
||||||
|
switch ($varrefs[3])
|
||||||
|
{
|
||||||
|
case 'S_ROW_NUM':
|
||||||
|
case 'S_ROW_COUNT':
|
||||||
|
$token = "\$_${namespace}_i";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_NUM_ROWS':
|
||||||
|
$token = "\$_${namespace}_count";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_FIRST_ROW':
|
||||||
|
$token = "(\$_${namespace}_i == 0)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_LAST_ROW':
|
||||||
|
$token = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_BLOCK_NAME':
|
||||||
|
$token = "'$namespace'";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']';
|
||||||
|
$token = '(isset(' . $token . ') ? ' . $token . ' : null)';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$token = ($varrefs[2]) ? '$_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$_rootref[\'' . $varrefs[3] . '\']';
|
||||||
|
$token = '(isset(' . $token . ') ? ' . $token . ' : null)';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (preg_match('#^\.((?:' . self::REGEX_NS . '\.?)+)$#s', $token, $varrefs))
|
||||||
|
{
|
||||||
|
// Allow checking if loops are set with .loopname
|
||||||
|
// It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
|
||||||
|
$blocks = explode('.', $varrefs[1]);
|
||||||
|
|
||||||
|
// If the block is nested, we have a reference that we can grab.
|
||||||
|
// If the block is not nested, we just go and grab the block from _tpldata
|
||||||
|
if (sizeof($blocks) > 1)
|
||||||
|
{
|
||||||
|
$block = array_pop($blocks);
|
||||||
|
$namespace = implode('.', $blocks);
|
||||||
|
$varref = $this->generate_block_data_ref($namespace, true);
|
||||||
|
|
||||||
|
// Add the block reference for the last child.
|
||||||
|
$varref .= "['" . $block . "']";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$varref = '$_tpldata';
|
||||||
|
|
||||||
|
// Add the block reference for the last child.
|
||||||
|
$varref .= "['" . $blocks[0] . "']";
|
||||||
|
}
|
||||||
|
$token = "(isset($varref) ? sizeof($varref) : 0)";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile IF tags
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression given with IF in source template
|
||||||
|
* @param bool $elseif True if compiling an IF tag, false if compiling an ELSEIF tag
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_if($tag_args, $elseif)
|
||||||
|
{
|
||||||
|
$tokens = $this->compile_expression($tag_args);
|
||||||
|
|
||||||
|
$tpl = ($elseif) ? '} else if (' : 'if (';
|
||||||
|
|
||||||
|
$tpl .= implode(' ', $tokens);
|
||||||
|
$tpl .= ') { ';
|
||||||
|
|
||||||
|
return $tpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile DEFINE tags
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression given with DEFINE in source template
|
||||||
|
* @param bool $op True if compiling a DEFINE tag, false if compiling an UNDEFINE tag
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_define($tag_args, $op)
|
||||||
|
{
|
||||||
|
$match = array();
|
||||||
|
preg_match('#^((?:' . self::REGEX_NS . '\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (.*?))?$#', $tag_args, $match);
|
||||||
|
|
||||||
|
if (empty($match[2]) || (!isset($match[3]) && $op))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$op)
|
||||||
|
{
|
||||||
|
return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ');';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsed_statement = implode(' ', $this->compile_expression($match[3]));
|
||||||
|
|
||||||
|
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $parsed_statement . ';';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile INCLUDE tag
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression given with INCLUDE in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_include($tag_args)
|
||||||
|
{
|
||||||
|
return "\$_template->_tpl_include('$tag_args');";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile INCLUDE_PHP tag
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression given with INCLUDEPHP in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_include_php($tag_args)
|
||||||
|
{
|
||||||
|
return "\$_template->_php_include('$tag_args');";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parse expression
|
||||||
|
* This is from Smarty
|
||||||
|
*/
|
||||||
|
private function _parse_is_expr($is_arg, $tokens)
|
||||||
|
{
|
||||||
|
$expr_end = 0;
|
||||||
|
$negate_expr = false;
|
||||||
|
|
||||||
|
if (($first_token = array_shift($tokens)) == 'not')
|
||||||
|
{
|
||||||
|
$negate_expr = true;
|
||||||
|
$expr_type = array_shift($tokens);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$expr_type = $first_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($expr_type)
|
||||||
|
{
|
||||||
|
case 'even':
|
||||||
|
if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
|
||||||
|
{
|
||||||
|
$expr_end++;
|
||||||
|
$expr_arg = $tokens[$expr_end++];
|
||||||
|
$expr = "!(($is_arg / $expr_arg) & 1)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$expr = "!($is_arg & 1)";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'odd':
|
||||||
|
if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
|
||||||
|
{
|
||||||
|
$expr_end++;
|
||||||
|
$expr_arg = $tokens[$expr_end++];
|
||||||
|
$expr = "(($is_arg / $expr_arg) & 1)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$expr = "($is_arg & 1)";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'div':
|
||||||
|
if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by')
|
||||||
|
{
|
||||||
|
$expr_end++;
|
||||||
|
$expr_arg = $tokens[$expr_end++];
|
||||||
|
$expr = "!($is_arg % $expr_arg)";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($negate_expr)
|
||||||
|
{
|
||||||
|
if ($expr[0] == '!')
|
||||||
|
{
|
||||||
|
// Negated expression, de-negate it.
|
||||||
|
$expr = substr($expr, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$expr = "!($expr)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
array_splice($tokens, 0, $expr_end, $expr);
|
||||||
|
|
||||||
|
return $tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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'] . '
|
||||||
|
* It's ready to be inserted into an "echo" line in one of the templates.
|
||||||
|
*
|
||||||
|
* @param string $namespace Namespace to access (expects a trailing "." on the namespace)
|
||||||
|
* @param string $varname Variable name to use
|
||||||
|
* @param bool $echo If true return an echo statement, otherwise a reference to the internal variable
|
||||||
|
* @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable
|
||||||
|
* @return string Code to access variable or echo it if $echo is true
|
||||||
|
*/
|
||||||
|
private function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
|
||||||
|
{
|
||||||
|
// Strip the trailing period.
|
||||||
|
$namespace = substr($namespace, 0, -1);
|
||||||
|
|
||||||
|
$expr = true;
|
||||||
|
$isset = false;
|
||||||
|
|
||||||
|
// S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
|
||||||
|
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
||||||
|
switch ($varname)
|
||||||
|
{
|
||||||
|
case 'S_ROW_NUM':
|
||||||
|
case 'S_ROW_COUNT':
|
||||||
|
$varref = "\$_${namespace}_i";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_NUM_ROWS':
|
||||||
|
$varref = "\$_${namespace}_count";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_FIRST_ROW':
|
||||||
|
$varref = "(\$_${namespace}_i == 0)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_LAST_ROW':
|
||||||
|
$varref = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S_BLOCK_NAME':
|
||||||
|
$varref = "'$namespace'";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Get a reference to the data block for this namespace.
|
||||||
|
$varref = $this->generate_block_data_ref($namespace, true, $defop);
|
||||||
|
// Prepend the necessary code to stick this in an echo line.
|
||||||
|
|
||||||
|
// Append the variable reference.
|
||||||
|
$varref .= "['$varname']";
|
||||||
|
|
||||||
|
$expr = false;
|
||||||
|
$isset = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// @todo Test the !$expr more
|
||||||
|
$varref = ($echo) ? '<?php echo ' . ($isset ? "isset($varref) ? $varref : ''" : $varref) . '; /**/?>' : (($expr || isset($varref)) ? $varref : '');
|
||||||
|
|
||||||
|
return $varref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a reference to the array of data values for the given
|
||||||
|
* (possibly nested) block namespace. This is a string of the form:
|
||||||
|
* $_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
|
||||||
|
*
|
||||||
|
* @param string $blockname Block to access (does not expect a trailing "." on the blockname)
|
||||||
|
* @param bool $include_last_iterator If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
|
||||||
|
* @param bool $defop If true this is a variable created with the DEFINE construct, otherwise template variable
|
||||||
|
* @return string Code to access variable
|
||||||
|
*/
|
||||||
|
private function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
|
||||||
|
{
|
||||||
|
// Get an array of the blocks involved.
|
||||||
|
$blocks = explode('.', $blockname);
|
||||||
|
$blockcount = sizeof($blocks) - 1;
|
||||||
|
|
||||||
|
// DEFINE is not an element of any referenced variable, we must use _tpldata to access it
|
||||||
|
if ($defop)
|
||||||
|
{
|
||||||
|
$varref = '$_tpldata[\'DEFINE\']';
|
||||||
|
// Build up the string with everything but the last child.
|
||||||
|
for ($i = 0; $i < $blockcount; $i++)
|
||||||
|
{
|
||||||
|
$varref .= "['" . $blocks[$i] . "'][\$_" . $blocks[$i] . '_i]';
|
||||||
|
}
|
||||||
|
// Add the block reference for the last child.
|
||||||
|
$varref .= "['" . $blocks[$blockcount] . "']";
|
||||||
|
// Add the iterator for the last child if requried.
|
||||||
|
if ($include_last_iterator)
|
||||||
|
{
|
||||||
|
$varref .= '[$_' . $blocks[$blockcount] . '_i]';
|
||||||
|
}
|
||||||
|
return $varref;
|
||||||
|
}
|
||||||
|
else if ($include_last_iterator)
|
||||||
|
{
|
||||||
|
return '$_'. $blocks[$blockcount] . '_val';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
211
phpBB/includes/template/locator.php
Normal file
211
phpBB/includes/template/locator.php
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template locator. Maintains mapping from template handles to source paths.
|
||||||
|
*
|
||||||
|
* Template locator is aware of template inheritance, and can return actual
|
||||||
|
* filesystem paths (i.e., the "primary" template or the "parent" template)
|
||||||
|
* depending on what files exist.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template_locator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string Path to directory that templates are stored in.
|
||||||
|
*/
|
||||||
|
private $root = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Path to parent/fallback template directory.
|
||||||
|
*/
|
||||||
|
private $inherit_root = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Map from handles to source template file paths.
|
||||||
|
* Normally it only contains paths for handles that are used
|
||||||
|
* (or are likely to be used) by the page being rendered and not
|
||||||
|
* all templates that exist on the filesystem.
|
||||||
|
*/
|
||||||
|
private $files = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Map from handles to source template file names.
|
||||||
|
* Covers the same data as $files property but maps to basenames
|
||||||
|
* instead of paths.
|
||||||
|
*/
|
||||||
|
private $filenames = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Map from handles to parent/fallback source template
|
||||||
|
* file paths. Covers the same data as $files.
|
||||||
|
*/
|
||||||
|
private $files_inherit = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom template location (able to use directory outside of phpBB).
|
||||||
|
*
|
||||||
|
* Note: Templates are still compiled to phpBB's cache directory.
|
||||||
|
*
|
||||||
|
* @param string $template_path Path to template directory
|
||||||
|
* @param string|bool $fallback_template_path Path to fallback template, or false to disable fallback
|
||||||
|
*/
|
||||||
|
public function set_custom_template($template_path, $fallback_template_path = false)
|
||||||
|
{
|
||||||
|
// Make sure $template_path has no ending slash
|
||||||
|
if (substr($template_path, -1) == '/')
|
||||||
|
{
|
||||||
|
$template_path = substr($template_path, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->root = $template_path;
|
||||||
|
|
||||||
|
if ($fallback_template_path !== false)
|
||||||
|
{
|
||||||
|
if (substr($fallback_template_path, -1) == '/')
|
||||||
|
{
|
||||||
|
$fallback_template_path = substr($fallback_template_path, 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->inherit_root = $fallback_template_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the template filenames for handles. $filename_array
|
||||||
|
* should be a hash of handle => filename pairs.
|
||||||
|
*
|
||||||
|
* @param array $filname_array Should be a hash of handle => filename pairs.
|
||||||
|
*/
|
||||||
|
public function set_filenames(array $filename_array)
|
||||||
|
{
|
||||||
|
foreach ($filename_array as $handle => $filename)
|
||||||
|
{
|
||||||
|
if (empty($filename))
|
||||||
|
{
|
||||||
|
trigger_error("template locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->filename[$handle] = $filename;
|
||||||
|
$this->files[$handle] = $this->root . '/' . $filename;
|
||||||
|
|
||||||
|
if ($this->inherit_root)
|
||||||
|
{
|
||||||
|
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the filename for a template handle.
|
||||||
|
*
|
||||||
|
* The filename comes from array used in a set_filenames call,
|
||||||
|
* which should have been performed prior to invoking this function.
|
||||||
|
* Return value is a file basename (without path).
|
||||||
|
*
|
||||||
|
* @param $handle string Template handle
|
||||||
|
* @return string Filename corresponding to the template handle
|
||||||
|
*/
|
||||||
|
public function get_filename_for_handle($handle)
|
||||||
|
{
|
||||||
|
if (!isset($this->filename[$handle]))
|
||||||
|
{
|
||||||
|
trigger_error("template locator: get_filename_for_handle: No file specified for handle $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
return $this->filename[$handle];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the source file path for a template handle without
|
||||||
|
* regard for template inheritance.
|
||||||
|
*
|
||||||
|
* This function returns the path in "primary" template directory
|
||||||
|
* corresponding to the given template handle. That path may or
|
||||||
|
* may not actually exist on the filesystem. Because this function
|
||||||
|
* does not perform stat calls to determine whether the path it
|
||||||
|
* returns actually exists, it is faster than get_source_file_for_handle.
|
||||||
|
*
|
||||||
|
* Use get_source_file_for_handle to obtain the actual path that is
|
||||||
|
* guaranteed to exist (which might come from the parent/fallback
|
||||||
|
* template directory if template inheritance is used).
|
||||||
|
*
|
||||||
|
* This function will trigger an error if the handle was never
|
||||||
|
* associated with a template file via set_filenames.
|
||||||
|
*
|
||||||
|
* @param $handle string Template handle
|
||||||
|
* @return string Path to source file path in primary template directory
|
||||||
|
*/
|
||||||
|
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[$handle]))
|
||||||
|
{
|
||||||
|
trigger_error("template locator: No file specified for handle $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$source_file = $this->files[$handle];
|
||||||
|
return $source_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the source file path for a template handle, accounting
|
||||||
|
* for template inheritance and verifying that the path exists.
|
||||||
|
*
|
||||||
|
* This function returns the actual path that may be compiled for
|
||||||
|
* the specified template handle. It will trigger an error if
|
||||||
|
* the template handle was never associated with a template path
|
||||||
|
* via set_filenames or if the template file does not exist on the
|
||||||
|
* filesystem.
|
||||||
|
*
|
||||||
|
* Use get_virtual_source_file_for_handle to just resolve a template
|
||||||
|
* handle to a path without any filesystem or inheritance checks.
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle (i.e. "friendly" template name)
|
||||||
|
* @return string Source file path
|
||||||
|
*/
|
||||||
|
public function get_source_file_for_handle($handle)
|
||||||
|
{
|
||||||
|
// If we don't have a file assigned to this handle, die.
|
||||||
|
if (!isset($this->files[$handle]))
|
||||||
|
{
|
||||||
|
trigger_error("template locator: No file specified for handle $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$source_file = $this->files[$handle];
|
||||||
|
|
||||||
|
// Try and open template for reading
|
||||||
|
if (!file_exists($source_file))
|
||||||
|
{
|
||||||
|
if (isset($this->files_inherit[$handle]) && $this->files_inherit[$handle])
|
||||||
|
{
|
||||||
|
$parent_source_file = $this->files_inherit[$handle];
|
||||||
|
if (!file_exists($parent_source_file))
|
||||||
|
{
|
||||||
|
trigger_error("template locator: Neither $source_file nor $parent_source_file exist", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
$source_file = $parent_source_file;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trigger_error("template locator: File $source_file does not exist", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $source_file;
|
||||||
|
}
|
||||||
|
}
|
35
phpBB/includes/template/renderer.php
Normal file
35
phpBB/includes/template/renderer.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template renderer interface.
|
||||||
|
*
|
||||||
|
* Objects implementing this interface encapsulate a means of displaying
|
||||||
|
* a template.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
interface phpbb_template_renderer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Displays the template managed by this renderer.
|
||||||
|
*
|
||||||
|
* @param phpbb_template_context $context Template context to use
|
||||||
|
* @param array $lang Language entries to use
|
||||||
|
*/
|
||||||
|
public function render($context, $lang);
|
||||||
|
}
|
60
phpBB/includes/template/renderer_eval.php
Normal file
60
phpBB/includes/template/renderer_eval.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template renderer that stores compiled template's php code and
|
||||||
|
* displays it via eval.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template_renderer_eval implements phpbb_template_renderer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Template code to be eval'ed.
|
||||||
|
*/
|
||||||
|
private $code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Stores provided code for future evaluation.
|
||||||
|
* Template includes are delegated to template object $template.
|
||||||
|
*
|
||||||
|
* @param string $code php code of the template
|
||||||
|
* @param phpbb_template $template template object
|
||||||
|
*/
|
||||||
|
public function __construct($code, $template)
|
||||||
|
{
|
||||||
|
$this->code = $code;
|
||||||
|
$this->template = $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the template managed by this renderer by eval'ing php code
|
||||||
|
* of the template.
|
||||||
|
*
|
||||||
|
* @param phpbb_template_context $context Template context to use
|
||||||
|
* @param array $lang Language entries to use
|
||||||
|
*/
|
||||||
|
public function render($context, $lang)
|
||||||
|
{
|
||||||
|
$_template = $this->template;
|
||||||
|
$_tpldata = &$context->get_data_ref();
|
||||||
|
$_rootref = &$context->get_root_ref();
|
||||||
|
$_lang = $lang;
|
||||||
|
|
||||||
|
eval($this->code);
|
||||||
|
}
|
||||||
|
}
|
60
phpBB/includes/template/renderer_include.php
Normal file
60
phpBB/includes/template/renderer_include.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template renderer that stores path to php file with template code
|
||||||
|
* and displays it by including the file.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template_renderer_include implements phpbb_template_renderer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Template path to be included.
|
||||||
|
*/
|
||||||
|
private $path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Stores path to the template for future inclusion.
|
||||||
|
* Template includes are delegated to template object $template.
|
||||||
|
*
|
||||||
|
* @param string $path path to the template
|
||||||
|
*/
|
||||||
|
public function __construct($path, $template)
|
||||||
|
{
|
||||||
|
$this->path = $path;
|
||||||
|
$this->template = $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the template managed by this renderer by including
|
||||||
|
* the php file containing the template.
|
||||||
|
*
|
||||||
|
* @param phpbb_template_context $context Template context to use
|
||||||
|
* @param array $lang Language entries to use
|
||||||
|
*/
|
||||||
|
public function render($context, $lang)
|
||||||
|
{
|
||||||
|
$_template = $this->template;
|
||||||
|
$_tpldata = &$context->get_data_ref();
|
||||||
|
$_rootref = &$context->get_root_ref();
|
||||||
|
$_lang = $lang;
|
||||||
|
|
||||||
|
include($this->path);
|
||||||
|
}
|
||||||
|
}
|
491
phpBB/includes/template/template.php
Normal file
491
phpBB/includes/template/template.php
Normal file
|
@ -0,0 +1,491 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo
|
||||||
|
* IMG_ for image substitution?
|
||||||
|
* {IMG_[key]:[alt]:[type]}
|
||||||
|
* {IMG_ICON_CONTACT:CONTACT:full} -> $user->img('icon_contact', 'CONTACT', 'full');
|
||||||
|
*
|
||||||
|
* More in-depth...
|
||||||
|
* yadayada
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base Template class.
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_template
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var phpbb_template_context Template context.
|
||||||
|
* Stores template data used during template rendering.
|
||||||
|
*/
|
||||||
|
private $context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Path of the cache directory for the template
|
||||||
|
*/
|
||||||
|
public $cachepath = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string phpBB root path
|
||||||
|
*/
|
||||||
|
private $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var phpEx PHP file extension
|
||||||
|
*/
|
||||||
|
private $phpEx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var phpbb_config phpBB config instance
|
||||||
|
*/
|
||||||
|
private $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var user current user
|
||||||
|
*/
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var locator template locator
|
||||||
|
*/
|
||||||
|
private $locator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $phpbb_root_path phpBB root path
|
||||||
|
* @param user $user current user
|
||||||
|
* @param phpbb_template_locator $locator template locator
|
||||||
|
*/
|
||||||
|
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_template_locator $locator)
|
||||||
|
{
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->phpEx = $phpEx;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->locator = $locator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set template location based on (current) user's chosen style.
|
||||||
|
*/
|
||||||
|
public function set_template()
|
||||||
|
{
|
||||||
|
$style_name = $this->user->theme['template_path'];
|
||||||
|
|
||||||
|
$relative_template_root = $this->relative_template_root_for_style($style_name);
|
||||||
|
$template_root = $this->phpbb_root_path . $relative_template_root;
|
||||||
|
if (!file_exists($template_root))
|
||||||
|
{
|
||||||
|
trigger_error('template locator: Template path could not be found: ' . $relative_template_root, E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->user->theme['template_inherits_id'])
|
||||||
|
{
|
||||||
|
$fallback_template_path = $this->phpbb_root_path . $this->relative_template_root_for_style($this->user->theme['template_inherit_path']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fallback_template_path = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->set_custom_template($template_root, $style_name, $fallback_template_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom template location (able to use directory outside of phpBB).
|
||||||
|
*
|
||||||
|
* Note: Templates are still compiled to phpBB's cache directory.
|
||||||
|
*
|
||||||
|
* @param string $template_path Path to template directory
|
||||||
|
* @param string $template_name Name of template
|
||||||
|
* @param string $fallback_template_path Path to fallback template
|
||||||
|
*/
|
||||||
|
public function set_custom_template($template_path, $style_name, $fallback_template_path = false)
|
||||||
|
{
|
||||||
|
$this->locator->set_custom_template($template_path, $fallback_template_path);
|
||||||
|
|
||||||
|
$this->cachepath = $this->phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $style_name) . '_';
|
||||||
|
|
||||||
|
$this->context = new phpbb_template_context();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a style name to relative (to board root) path to
|
||||||
|
* the style's template files.
|
||||||
|
*
|
||||||
|
* @param $style_name string Style name
|
||||||
|
* @return string Path to style template files
|
||||||
|
*/
|
||||||
|
private function relative_template_root_for_style($style_name)
|
||||||
|
{
|
||||||
|
return 'styles/' . $style_name . '/template';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the template filenames for handles.
|
||||||
|
*
|
||||||
|
* @param array $filname_array Should be a hash of handle => filename pairs.
|
||||||
|
*/
|
||||||
|
public function set_filenames(array $filename_array)
|
||||||
|
{
|
||||||
|
$this->locator->set_filenames($filename_array);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears all variables and blocks assigned to this template.
|
||||||
|
*/
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
$this->context->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset/empty complete block
|
||||||
|
*
|
||||||
|
* @param string $blockname Name of block to destroy
|
||||||
|
*/
|
||||||
|
public function destroy_block_vars($blockname)
|
||||||
|
{
|
||||||
|
$this->context->destroy_block_vars($blockname);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a template for provided handle.
|
||||||
|
*
|
||||||
|
* The template will be loaded and compiled, if necessary, first.
|
||||||
|
*
|
||||||
|
* This function calls hooks.
|
||||||
|
*
|
||||||
|
* @param string $handle Handle to display
|
||||||
|
* @return bool True on success, false on failure
|
||||||
|
*/
|
||||||
|
public function display($handle)
|
||||||
|
{
|
||||||
|
$result = $this->call_hook($handle);
|
||||||
|
if ($result !== false)
|
||||||
|
{
|
||||||
|
return $result[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->load_and_render($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a template for $handle, compiling it if necessary, and
|
||||||
|
* renders the template.
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle to render
|
||||||
|
* @return bool True on success, false on failure
|
||||||
|
*/
|
||||||
|
private function load_and_render($handle)
|
||||||
|
{
|
||||||
|
$renderer = $this->_tpl_load($handle);
|
||||||
|
|
||||||
|
if ($renderer)
|
||||||
|
{
|
||||||
|
$renderer->render($this->context, $this->get_lang());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls hook if any is defined.
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle being displayed.
|
||||||
|
*/
|
||||||
|
private function call_hook($handle)
|
||||||
|
{
|
||||||
|
global $phpbb_hook;
|
||||||
|
|
||||||
|
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $this))
|
||||||
|
{
|
||||||
|
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
||||||
|
{
|
||||||
|
$result = $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
||||||
|
return array($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains language array.
|
||||||
|
* This is either lang property of $user property, or if
|
||||||
|
* it is not set an empty array.
|
||||||
|
* @return array language entries
|
||||||
|
*/
|
||||||
|
public function get_lang()
|
||||||
|
{
|
||||||
|
if (isset($this->user->lang))
|
||||||
|
{
|
||||||
|
$lang = $this->user->lang;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lang = array();
|
||||||
|
}
|
||||||
|
return $lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the handle and assign the output to a template variable
|
||||||
|
* or return the compiled result.
|
||||||
|
*
|
||||||
|
* @param string $handle Handle to operate on
|
||||||
|
* @param string $template_var Template variable to assign compiled handle to
|
||||||
|
* @param bool $return_content If true return compiled handle, otherwise assign to $template_var
|
||||||
|
* @return bool|string false on failure, otherwise if $return_content is true return string of the compiled handle, otherwise return true
|
||||||
|
*/
|
||||||
|
public function assign_display($handle, $template_var = '', $return_content = true)
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
$result = $this->display($handle);
|
||||||
|
$contents = ob_get_clean();
|
||||||
|
if ($result === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($return_content)
|
||||||
|
{
|
||||||
|
return $contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign_var($template_var, $contents);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains a template renderer for a template identified by specified
|
||||||
|
* handle. The template renderer can display the template later.
|
||||||
|
*
|
||||||
|
* Template source will first be compiled into php code.
|
||||||
|
* If template cache is writable the compiled php code will be stored
|
||||||
|
* on filesystem and template will not be subsequently recompiled.
|
||||||
|
* If template cache is not writable template source will be recompiled
|
||||||
|
* every time it is needed. DEBUG_EXTRA define and load_tplcompile
|
||||||
|
* configuration setting may be used to force templates to be always
|
||||||
|
* recompiled.
|
||||||
|
*
|
||||||
|
* Returns an object implementing phpbb_template_renderer, or null
|
||||||
|
* if template loading or compilation failed. Call render() on the
|
||||||
|
* renderer to display the template. This will result in template
|
||||||
|
* contents sent to the output stream (unless, of course, output
|
||||||
|
* buffering is in effect).
|
||||||
|
*
|
||||||
|
* @param string $handle Handle of the template to load
|
||||||
|
* @return phpbb_template_renderer Template renderer object, or null on failure
|
||||||
|
* @uses template_compile is used to compile template source
|
||||||
|
*/
|
||||||
|
private function _tpl_load($handle)
|
||||||
|
{
|
||||||
|
$virtual_source_file = $this->locator->get_virtual_source_file_for_handle($handle);
|
||||||
|
$source_file = null;
|
||||||
|
|
||||||
|
$compiled_path = $this->cachepath . str_replace('/', '.', $virtual_source_file) . '.' . $this->phpEx;
|
||||||
|
|
||||||
|
$recompile = defined('DEBUG_EXTRA') ||
|
||||||
|
!file_exists($compiled_path) ||
|
||||||
|
@filesize($compiled_path) === 0 ||
|
||||||
|
($this->config['load_tplcompile'] && @filemtime($compiled_path) < @filemtime($source_file));
|
||||||
|
|
||||||
|
if (!$recompile && $this->config['load_tplcompile'])
|
||||||
|
{
|
||||||
|
$source_file = $this->locator->get_source_file_for_handle($handle);
|
||||||
|
$recompile = (@filemtime($compiled_path) < @filemtime($source_file)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recompile page if the original template is newer, otherwise load the compiled version
|
||||||
|
if (!$recompile)
|
||||||
|
{
|
||||||
|
return new phpbb_template_renderer_include($compiled_path, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($source_file === null)
|
||||||
|
{
|
||||||
|
$source_file = $this->locator->get_source_file_for_handle($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
$compile = new phpbb_template_compile($this->config['tpl_allow_php']);
|
||||||
|
|
||||||
|
$output_file = $this->_compiled_file_for_handle($handle);
|
||||||
|
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||||
|
{
|
||||||
|
$renderer = new phpbb_template_renderer_include($output_file, $this);
|
||||||
|
}
|
||||||
|
else if (($code = $compile->compile_file($source_file)) !== false)
|
||||||
|
{
|
||||||
|
$renderer = new phpbb_template_renderer_eval($code, $this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$renderer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $renderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines compiled file path for handle $handle.
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle (i.e. "friendly" template name)
|
||||||
|
* @return string Compiled file path
|
||||||
|
*/
|
||||||
|
private function _compiled_file_for_handle($handle)
|
||||||
|
{
|
||||||
|
$source_file = $this->locator->get_filename_for_handle($handle);
|
||||||
|
$compiled_file = $this->cachepath . str_replace('/', '.', $source_file) . '.' . $this->phpEx;
|
||||||
|
return $compiled_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign key variable pairs from an array
|
||||||
|
*
|
||||||
|
* @param array $vararray A hash of variable name => value pairs
|
||||||
|
*/
|
||||||
|
public function assign_vars(array $vararray)
|
||||||
|
{
|
||||||
|
foreach ($vararray as $key => $val)
|
||||||
|
{
|
||||||
|
$this->assign_var($key, $val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign a single variable to a single key
|
||||||
|
*
|
||||||
|
* @param string $varname Variable name
|
||||||
|
* @param string $varval Value to assign to variable
|
||||||
|
*/
|
||||||
|
public function assign_var($varname, $varval)
|
||||||
|
{
|
||||||
|
$this->context->assign_var($varname, $varval);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Docstring is copied from phpbb_template_context method with the same name.
|
||||||
|
/**
|
||||||
|
* Assign key variable pairs from an array to a specified block
|
||||||
|
* @param string $blockname Name of block to assign $vararray to
|
||||||
|
* @param array $vararray A hash of variable name => value pairs
|
||||||
|
*/
|
||||||
|
public function assign_block_vars($blockname, array $vararray)
|
||||||
|
{
|
||||||
|
return $this->context->assign_block_vars($blockname, $vararray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Docstring is copied from phpbb_template_context method with the same name.
|
||||||
|
/**
|
||||||
|
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
||||||
|
*
|
||||||
|
* An example of how to use this function:
|
||||||
|
* {@example alter_block_array.php}
|
||||||
|
*
|
||||||
|
* @param string $blockname the blockname, for example 'loop'
|
||||||
|
* @param array $vararray the var array to insert/add or merge
|
||||||
|
* @param mixed $key Key to search for
|
||||||
|
*
|
||||||
|
* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
|
||||||
|
*
|
||||||
|
* int: Position [the position to change or insert at directly given]
|
||||||
|
*
|
||||||
|
* If key is false the position is set to 0
|
||||||
|
* If key is true the position is set to the last entry
|
||||||
|
*
|
||||||
|
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
|
||||||
|
*
|
||||||
|
* If insert, the vararray is inserted at the given position (position counting from zero).
|
||||||
|
* If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
|
||||||
|
*
|
||||||
|
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
|
||||||
|
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
|
||||||
|
*
|
||||||
|
* @return bool false on error, true on success
|
||||||
|
*/
|
||||||
|
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
|
||||||
|
{
|
||||||
|
return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include a separate template.
|
||||||
|
*
|
||||||
|
* This function is marked public due to the way the template
|
||||||
|
* implementation uses it. It is actually an implementation function
|
||||||
|
* and should not be considered part of template class's public API.
|
||||||
|
*
|
||||||
|
* @param string $filename Template filename to include
|
||||||
|
* @param bool $include True to include the file, false to just load it
|
||||||
|
* @uses template_compile is used to compile uncached templates
|
||||||
|
*/
|
||||||
|
public function _tpl_include($filename, $include = true)
|
||||||
|
{
|
||||||
|
$this->locator->set_filenames(array($filename => $filename));
|
||||||
|
|
||||||
|
if (!$this->load_and_render($filename))
|
||||||
|
{
|
||||||
|
// trigger_error cannot be used here, as the output already started
|
||||||
|
echo 'template->_tpl_include(): Failed including ' . htmlspecialchars($handle) . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include a PHP file.
|
||||||
|
*
|
||||||
|
* If a relative path is passed in $filename, it is considered to be
|
||||||
|
* relative to board root ($phpbb_root_path). Absolute paths are
|
||||||
|
* also allowed.
|
||||||
|
*
|
||||||
|
* This function is marked public due to the way the template
|
||||||
|
* implementation uses it. It is actually an implementation function
|
||||||
|
* and should not be considered part of template class's public API.
|
||||||
|
*
|
||||||
|
* @param string $filename Path to PHP file to include
|
||||||
|
*/
|
||||||
|
public function _php_include($filename)
|
||||||
|
{
|
||||||
|
if (phpbb_is_absolute($filename))
|
||||||
|
{
|
||||||
|
$file = $filename;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$file = $this->phpbb_root_path . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file_exists($file))
|
||||||
|
{
|
||||||
|
// trigger_error cannot be used here, as the output already started
|
||||||
|
echo 'template->_php_include(): File ' . htmlspecialchars($file) . " does not exist\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
include($file);
|
||||||
|
}
|
||||||
|
}
|
|
@ -156,13 +156,12 @@ class ucp_register
|
||||||
$this->tpl_name = 'ucp_agreement';
|
$this->tpl_name = 'ucp_agreement';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
|
||||||
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
|
|
||||||
if ($config['enable_confirm'])
|
if ($config['enable_confirm'])
|
||||||
{
|
{
|
||||||
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||||
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
$captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
||||||
$captcha->init(CONFIRM_REG);
|
$captcha->init(CONFIRM_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ $legend = implode(', ', $legend);
|
||||||
$birthday_list = array();
|
$birthday_list = array();
|
||||||
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||||
{
|
{
|
||||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
||||||
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
|
||||||
FROM ' . USERS_TABLE . ' u
|
FROM ' . USERS_TABLE . ' u
|
||||||
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
|
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
|
||||||
|
|
|
@ -84,7 +84,6 @@ if (!empty($load_extensions) && function_exists('dl'))
|
||||||
|
|
||||||
// Include files
|
// Include files
|
||||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/template.' . $phpEx);
|
|
||||||
require($phpbb_root_path . 'includes/session.' . $phpEx);
|
require($phpbb_root_path . 'includes/session.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
||||||
|
|
||||||
|
@ -205,14 +204,10 @@ $ga_forum_id = request_var('ga_forum_id', 0);
|
||||||
if ($has_global && !$ga_forum_id)
|
if ($has_global && !$ga_forum_id)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>">
|
<html dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
||||||
<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
|
|
||||||
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
||||||
|
|
||||||
|
@ -259,14 +254,10 @@ if ($has_global && !$ga_forum_id)
|
||||||
header('Content-type: text/html; charset=UTF-8');
|
header('Content-type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>">
|
<html dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
||||||
<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
|
|
||||||
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,9 @@ define('IN_INSTALL', true);
|
||||||
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
|
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
|
||||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||||
|
|
||||||
// @todo Review this test and see if we can find out what it is which prevents PHP 4.2.x from even displaying the page with requirements on it
|
if (version_compare(PHP_VERSION, '5.2.0') < 0)
|
||||||
if (version_compare(PHP_VERSION, '4.3.3') < 0)
|
|
||||||
{
|
{
|
||||||
die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install phpBB 3.0');
|
die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install phpBB 3.1');
|
||||||
}
|
}
|
||||||
|
|
||||||
function phpbb_require_updated($path, $optional = false)
|
function phpbb_require_updated($path, $optional = false)
|
||||||
|
@ -79,7 +78,6 @@ phpbb_require_updated('includes/functions_content.' . $phpEx, true);
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/auth.' . $phpEx);
|
include($phpbb_root_path . 'includes/auth.' . $phpEx);
|
||||||
include($phpbb_root_path . 'includes/session.' . $phpEx);
|
include($phpbb_root_path . 'includes/session.' . $phpEx);
|
||||||
include($phpbb_root_path . 'includes/template.' . $phpEx);
|
|
||||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
|
||||||
|
@ -179,7 +177,6 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle
|
||||||
|
|
||||||
$user = new user();
|
$user = new user();
|
||||||
$auth = new auth();
|
$auth = new auth();
|
||||||
$template = new template();
|
|
||||||
|
|
||||||
// Add own hook handler, if present. :o
|
// Add own hook handler, if present. :o
|
||||||
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
||||||
|
@ -202,6 +199,8 @@ $config = new phpbb_config(array(
|
||||||
'load_tplcompile' => '1'
|
'load_tplcompile' => '1'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$template_locator = new phpbb_template_locator();
|
||||||
|
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
|
||||||
$template->set_custom_template('../adm/style', 'admin');
|
$template->set_custom_template('../adm/style', 'admin');
|
||||||
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
|
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
|
||||||
|
|
||||||
|
@ -556,10 +555,10 @@ class module
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
echo '<!DOCTYPE html>';
|
||||||
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
|
echo '<html dir="ltr">';
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
echo '<meta charset="utf-8">';
|
||||||
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
|
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
|
||||||
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
|
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
|
||||||
echo '</head>';
|
echo '</head>';
|
||||||
|
|
|
@ -141,7 +141,7 @@ class install_install extends module
|
||||||
// Test the minimum PHP version
|
// Test the minimum PHP version
|
||||||
$php_version = PHP_VERSION;
|
$php_version = PHP_VERSION;
|
||||||
|
|
||||||
if (version_compare($php_version, '4.3.3') < 0)
|
if (version_compare($php_version, '5.2.0') < 0)
|
||||||
{
|
{
|
||||||
$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
|
$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ $lang = array_merge($lang, array(
|
||||||
'SYSTEM_TIMEZONE' => 'Guest timezone',
|
'SYSTEM_TIMEZONE' => 'Guest timezone',
|
||||||
'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in their user control panel.',
|
'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in their user control panel.',
|
||||||
'WARNINGS_EXPIRE' => 'Warning duration',
|
'WARNINGS_EXPIRE' => 'Warning duration',
|
||||||
'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before the warning will automatically expire from a user’s record.',
|
'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before the warning will automatically expire from a user’s record. Set this value to 0 to make warnings permanent.',
|
||||||
));
|
));
|
||||||
|
|
||||||
// Board Features
|
// Board Features
|
||||||
|
|
|
@ -653,6 +653,10 @@ $lang = array_merge($lang, array(
|
||||||
'UNREAD_PMS' => '<strong>%d</strong> unread messages',
|
'UNREAD_PMS' => '<strong>%d</strong> unread messages',
|
||||||
'UNREAD_POST' => 'Unread post',
|
'UNREAD_POST' => 'Unread post',
|
||||||
'UNREAD_POSTS' => 'Unread posts',
|
'UNREAD_POSTS' => 'Unread posts',
|
||||||
|
'UNWATCH_FORUM_CONFIRM' => 'Are you sure you wish to unsubscribe from this forum?',
|
||||||
|
'UNWATCH_FORUM_DETAILED' => 'Are you sure you wish to unsubscribe from the forum “%s”?',
|
||||||
|
'UNWATCH_TOPIC_CONFIRM' => 'Are you sure you wish to unsubscribe from this topic?',
|
||||||
|
'UNWATCH_TOPIC_DETAILED' => 'Are you sure you wish to unsubscribe from the topic “%s”?',
|
||||||
'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.',
|
'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.',
|
||||||
'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.',
|
'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.',
|
||||||
'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.',
|
'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.',
|
||||||
|
@ -701,6 +705,10 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
'WARNINGS' => 'Warnings',
|
'WARNINGS' => 'Warnings',
|
||||||
'WARN_USER' => 'Warn user',
|
'WARN_USER' => 'Warn user',
|
||||||
|
'WATCH_FORUM_CONFIRM' => 'Are you sure you wish to subscribe to this forum?',
|
||||||
|
'WATCH_FORUM_DETAILED' => 'Are you sure you wish to subscribe to the forum “%s”?',
|
||||||
|
'WATCH_TOPIC_CONFIRM' => 'Are you sure you wish to subscribe to this topic?',
|
||||||
|
'WATCH_TOPIC_DETAILED' => 'Are you sure you wish to subscribe to the topic “%s”?',
|
||||||
'WELCOME_SUBJECT' => 'Welcome to %s forums',
|
'WELCOME_SUBJECT' => 'Welcome to %s forums',
|
||||||
'WEBSITE' => 'Website',
|
'WEBSITE' => 'Website',
|
||||||
'WHOIS' => 'Whois',
|
'WHOIS' => 'Whois',
|
||||||
|
|
|
@ -300,10 +300,10 @@ $lang = array_merge($lang, array(
|
||||||
'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.',
|
'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.',
|
||||||
'PHP_SAFE_MODE' => 'Safe mode',
|
'PHP_SAFE_MODE' => 'Safe mode',
|
||||||
'PHP_SETTINGS' => 'PHP version and settings',
|
'PHP_SETTINGS' => 'PHP version and settings',
|
||||||
'PHP_SETTINGS_EXPLAIN' => '<strong>Required</strong> - You must be running at least version 4.3.3 of PHP in order to install phpBB. If <var>safe mode</var> is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.',
|
'PHP_SETTINGS_EXPLAIN' => '<strong>Required</strong> - You must be running at least version 5.2.0 of PHP in order to install phpBB. If <var>safe mode</var> is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.',
|
||||||
'PHP_URL_FOPEN_SUPPORT' => 'PHP setting <var>allow_url_fopen</var> is enabled',
|
'PHP_URL_FOPEN_SUPPORT' => 'PHP setting <var>allow_url_fopen</var> is enabled',
|
||||||
'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => '<strong>Optional</strong> - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.',
|
'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => '<strong>Optional</strong> - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.',
|
||||||
'PHP_VERSION_REQD' => 'PHP version >= 4.3.3',
|
'PHP_VERSION_REQD' => 'PHP version >= 5.2.0',
|
||||||
'POST_ID' => 'Post ID',
|
'POST_ID' => 'Post ID',
|
||||||
'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using <strong>%s</strong> as table prefix.',
|
'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using <strong>%s</strong> as table prefix.',
|
||||||
'PREPROCESS_STEP' => 'Executing pre-processing functions/queries',
|
'PREPROCESS_STEP' => 'Executing pre-processing functions/queries',
|
||||||
|
@ -495,7 +495,7 @@ $lang = array_merge($lang, array(
|
||||||
'SHOW_DIFF_NEW' => 'Show file contents',
|
'SHOW_DIFF_NEW' => 'Show file contents',
|
||||||
'SHOW_DIFF_NEW_CONFLICT' => 'Show differences',
|
'SHOW_DIFF_NEW_CONFLICT' => 'Show differences',
|
||||||
'SHOW_DIFF_NOT_MODIFIED' => 'Show differences',
|
'SHOW_DIFF_NOT_MODIFIED' => 'Show differences',
|
||||||
'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listing below.',
|
'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.',
|
||||||
'SQL' => 'SQL',
|
'SQL' => 'SQL',
|
||||||
'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See <a href="../docs/README.html">README</a> for details on how to obtain advice.',
|
'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See <a href="../docs/README.html">README</a> for details on how to obtain advice.',
|
||||||
'STAGE_FILE_CHECK' => 'Check files',
|
'STAGE_FILE_CHECK' => 'Check files',
|
||||||
|
|
|
@ -48,7 +48,7 @@ $lang = array_merge($lang, array(
|
||||||
'BBCODE_A_HELP' => 'Inline uploaded attachment: [attachment=]filename.ext[/attachment]',
|
'BBCODE_A_HELP' => 'Inline uploaded attachment: [attachment=]filename.ext[/attachment]',
|
||||||
'BBCODE_B_HELP' => 'Bold text: [b]text[/b]',
|
'BBCODE_B_HELP' => 'Bold text: [b]text[/b]',
|
||||||
'BBCODE_C_HELP' => 'Code display: [code]code[/code]',
|
'BBCODE_C_HELP' => 'Code display: [code]code[/code]',
|
||||||
'BBCODE_E_HELP' => 'List: Add list element',
|
'BBCODE_D_HELP' => 'Flash: [flash=width,height]http://url[/flash]',
|
||||||
'BBCODE_F_HELP' => 'Font size: [size=85]small text[/size]',
|
'BBCODE_F_HELP' => 'Font size: [size=85]small text[/size]',
|
||||||
'BBCODE_IS_OFF' => '%sBBCode%s is <em>OFF</em>',
|
'BBCODE_IS_OFF' => '%sBBCode%s is <em>OFF</em>',
|
||||||
'BBCODE_IS_ON' => '%sBBCode%s is <em>ON</em>',
|
'BBCODE_IS_ON' => '%sBBCode%s is <em>ON</em>',
|
||||||
|
@ -61,7 +61,7 @@ $lang = array_merge($lang, array(
|
||||||
'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] Tip: you can also use color=#FF0000',
|
'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] Tip: you can also use color=#FF0000',
|
||||||
'BBCODE_U_HELP' => 'Underline text: [u]text[/u]',
|
'BBCODE_U_HELP' => 'Underline text: [u]text[/u]',
|
||||||
'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]',
|
'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]',
|
||||||
'BBCODE_D_HELP' => 'Flash: [flash=width,height]http://url[/flash]',
|
'BBCODE_Y_HELP' => 'List: Add list element',
|
||||||
'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.',
|
'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.',
|
||||||
|
|
||||||
'CANNOT_DELETE_REPLIED' => 'Sorry but you may only delete posts which have not been replied to.',
|
'CANNOT_DELETE_REPLIED' => 'Sorry but you may only delete posts which have not been replied to.',
|
||||||
|
|
|
@ -1295,13 +1295,6 @@ switch ($mode)
|
||||||
$total_users = $config['num_users'];
|
$total_users = $config['num_users'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$s_char_options = '<option value=""' . ((!$first_char) ? ' selected="selected"' : '') . '> </option>';
|
|
||||||
for ($i = 97; $i < 123; $i++)
|
|
||||||
{
|
|
||||||
$s_char_options .= '<option value="' . chr($i) . '"' . (($first_char == chr($i)) ? ' selected="selected"' : '') . '>' . chr($i-32) . '</option>';
|
|
||||||
}
|
|
||||||
$s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . $user->lang['OTHER'] . '</option>';
|
|
||||||
|
|
||||||
// Build a relevant pagination_url
|
// Build a relevant pagination_url
|
||||||
$params = $sort_params = array();
|
$params = $sort_params = array();
|
||||||
|
|
||||||
|
@ -1331,6 +1324,7 @@ switch ($mode)
|
||||||
'first_char' => array('first_char', ''),
|
'first_char' => array('first_char', ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$u_first_char_params = array();
|
||||||
foreach ($check_params as $key => $call)
|
foreach ($check_params as $key => $call)
|
||||||
{
|
{
|
||||||
if (!isset($_REQUEST[$key]))
|
if (!isset($_REQUEST[$key]))
|
||||||
|
@ -1342,6 +1336,10 @@ switch ($mode)
|
||||||
$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
|
$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
|
||||||
$params[] = $param;
|
$params[] = $param;
|
||||||
|
|
||||||
|
if ($key != 'first_char')
|
||||||
|
{
|
||||||
|
$u_first_char_params[] = $param;
|
||||||
|
}
|
||||||
if ($key != 'sk' && $key != 'sd')
|
if ($key != 'sk' && $key != 'sd')
|
||||||
{
|
{
|
||||||
$sort_params[] = $param;
|
$sort_params[] = $param;
|
||||||
|
@ -1361,6 +1359,27 @@ switch ($mode)
|
||||||
|
|
||||||
unset($search_params, $sort_params);
|
unset($search_params, $sort_params);
|
||||||
|
|
||||||
|
$u_first_char_params = implode('&', $u_first_char_params);
|
||||||
|
$u_first_char_params .= ($u_first_char_params) ? '&' : '';
|
||||||
|
|
||||||
|
$first_characters = array();
|
||||||
|
$first_characters[''] = $user->lang['ALL'];
|
||||||
|
for ($i = 97; $i < 123; $i++)
|
||||||
|
{
|
||||||
|
$first_characters[chr($i)] = chr($i - 32);
|
||||||
|
}
|
||||||
|
$first_characters['other'] = $user->lang['OTHER'];
|
||||||
|
|
||||||
|
foreach ($first_characters as $char => $desc)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('first_char', array(
|
||||||
|
'DESC' => $desc,
|
||||||
|
'VALUE' => $char,
|
||||||
|
'S_SELECTED' => ($first_char == $char) ? true : false,
|
||||||
|
'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// Some search user specific data
|
// Some search user specific data
|
||||||
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
|
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
|
||||||
{
|
{
|
||||||
|
@ -1528,7 +1547,7 @@ switch ($mode)
|
||||||
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
|
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
|
||||||
{
|
{
|
||||||
$user_id = $user_list[$i];
|
$user_id = $user_list[$i];
|
||||||
$row =& $id_cache[$user_id];
|
$row = $id_cache[$user_id];
|
||||||
$is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false;
|
$is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false;
|
||||||
$leaders_set = ($leaders_set || $is_leader);
|
$leaders_set = ($leaders_set || $is_leader);
|
||||||
|
|
||||||
|
@ -1605,7 +1624,6 @@ switch ($mode)
|
||||||
'S_LEADERS_SET' => $leaders_set,
|
'S_LEADERS_SET' => $leaders_set,
|
||||||
'S_MODE_SELECT' => $s_sort_key,
|
'S_MODE_SELECT' => $s_sort_key,
|
||||||
'S_ORDER_SELECT' => $s_sort_dir,
|
'S_ORDER_SELECT' => $s_sort_dir,
|
||||||
'S_CHAR_OPTIONS' => $s_char_options,
|
|
||||||
'S_MODE_ACTION' => $pagination_url)
|
'S_MODE_ACTION' => $pagination_url)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1669,7 +1687,7 @@ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = f
|
||||||
|
|
||||||
if ($bday_year)
|
if ($bday_year)
|
||||||
{
|
{
|
||||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
||||||
|
|
||||||
$diff = $now['mon'] - $bday_month;
|
$diff = $now['mon'] - $bday_month;
|
||||||
if ($diff == 0)
|
if ($diff == 0)
|
||||||
|
|
|
@ -180,7 +180,7 @@ $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']);
|
||||||
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
|
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
|
||||||
{
|
{
|
||||||
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||||
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
$captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
||||||
$captcha->init(CONFIRM_POST);
|
$captcha->init(CONFIRM_POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,13 @@ if (!$post_id && (!$pm_id || !$config['allow_pm_report']))
|
||||||
if ($post_id)
|
if ($post_id)
|
||||||
{
|
{
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";
|
$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";
|
||||||
|
$return_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id");
|
||||||
$pm_id = 0;
|
$pm_id = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id");
|
$redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&p=$pm_id");
|
||||||
|
$return_forum_url = '';
|
||||||
$post_id = 0;
|
$post_id = 0;
|
||||||
$forum_id = 0;
|
$forum_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +103,7 @@ if ($post_id)
|
||||||
{
|
{
|
||||||
$message = $user->lang['ALREADY_REPORTED'];
|
$message = $user->lang['ALREADY_REPORTED'];
|
||||||
$message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
|
$message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,6 +212,10 @@ if ($submit && $reason_id)
|
||||||
meta_refresh(3, $redirect_url);
|
meta_refresh(3, $redirect_url);
|
||||||
|
|
||||||
$message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
|
$message = $lang_success . '<br /><br />' . sprintf($lang_return, '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
if ($return_forum_url)
|
||||||
|
{
|
||||||
|
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $return_forum_url . '">', '</a>');
|
||||||
|
}
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<ul class="topiclist">
|
<ul class="topiclist">
|
||||||
<li class="header">
|
<li class="header">
|
||||||
<dl class="icon">
|
<dl class="icon">
|
||||||
<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
|
<dt><div class="wrap-content"><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></div></dt>
|
||||||
<dd class="topics">{L_TOPICS}</dd>
|
<dd class="topics">{L_TOPICS}</dd>
|
||||||
<dd class="posts">{L_POSTS}</dd>
|
<dd class="posts">{L_POSTS}</dd>
|
||||||
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
|
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
<!-- IF not forumrow.S_IS_CAT -->
|
<!-- IF not forumrow.S_IS_CAT -->
|
||||||
<li class="row">
|
<li class="row">
|
||||||
<dl class="icon {forumrow.FORUM_IMG_STYLE}">
|
<dl class="icon {forumrow.FORUM_IMG_STYLE}">
|
||||||
<dt title="{forumrow.FORUM_FOLDER_IMG_ALT}">
|
<dt title="{forumrow.FORUM_FOLDER_IMG_ALT}"><div class="wrap-content">
|
||||||
|
|
||||||
<!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF -->
|
<!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF forumrow.FORUM_IMAGE --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><!-- ENDIF -->
|
<!-- IF forumrow.FORUM_IMAGE --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><!-- ENDIF -->
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
<br /><strong>{forumrow.L_MODERATOR_STR}:</strong> {forumrow.MODERATORS}
|
<br /><strong>{forumrow.L_MODERATOR_STR}:</strong> {forumrow.MODERATORS}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF forumrow.SUBFORUMS and forumrow.S_LIST_SUBFORUMS --><br /><strong>{forumrow.L_SUBFORUM_STR}</strong> {forumrow.SUBFORUMS}<!-- ENDIF -->
|
<!-- IF forumrow.SUBFORUMS and forumrow.S_LIST_SUBFORUMS --><br /><strong>{forumrow.L_SUBFORUM_STR}</strong> {forumrow.SUBFORUMS}<!-- ENDIF -->
|
||||||
</dt>
|
</div></dt>
|
||||||
<!-- IF forumrow.CLICKS -->
|
<!-- IF forumrow.CLICKS -->
|
||||||
<dd class="redirect"><span>{L_REDIRECTS}: {forumrow.CLICKS}</span></dd>
|
<dd class="redirect"><span>{L_REDIRECTS}: {forumrow.CLICKS}</span></dd>
|
||||||
<!-- ELSEIF not forumrow.S_IS_LINK -->
|
<!-- ELSEIF not forumrow.S_IS_LINK -->
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- IF S_DISPLAY_JUMPBOX -->
|
<!-- IF S_DISPLAY_JUMPBOX -->
|
||||||
<form method="post" id="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(document.jumpbox.f.value == -1){return false;}">
|
<form method="post" id="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(this.f.value == -1){return false;}">
|
||||||
|
|
||||||
<!-- IF $CUSTOM_FIELDSET_CLASS -->
|
<!-- IF $CUSTOM_FIELDSET_CLASS -->
|
||||||
<fieldset class="{$CUSTOM_FIELDSET_CLASS}">
|
<fieldset class="{$CUSTOM_FIELDSET_CLASS}">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<dl class="fields2">
|
<dl class="fields2">
|
||||||
<dt><label>{L_SELECT_DESTINATION_FORUM}:</label></dt>
|
<dt><label>{L_SELECT_DESTINATION_FORUM}:</label></dt>
|
||||||
<dd><select name="to_forum_id">{S_FORUM_SELECT}</select></dd>
|
<dd><select name="to_forum_id">{S_FORUM_SELECT}</select></dd>
|
||||||
<!-- IF S_CAN_LEAVE_SHADOW --><dd><label for="move_leave_shadow"><input type="checkbox" name="move_leave_shadow" id="move_leave_shadow" checked="checked" />{L_LEAVE_SHADOW}</label></dd><!-- ENDIF -->
|
<!-- IF S_CAN_LEAVE_SHADOW --><dd><label for="move_leave_shadow"><input type="checkbox" name="move_leave_shadow" id="move_leave_shadow" />{L_LEAVE_SHADOW}</label></dd><!-- ENDIF -->
|
||||||
<!-- IF S_CAN_LOCK_TOPIC --><dd><label for="move_lock_topics"><input type="checkbox" name="move_lock_topics" id="move_lock_topics" />{L_LOCK_TOPIC}</label></dd><!-- ENDIF -->
|
<!-- IF S_CAN_LOCK_TOPIC --><dd><label for="move_lock_topics"><input type="checkbox" name="move_lock_topics" id="move_lock_topics" />{L_LOCK_TOPIC}</label></dd><!-- ENDIF -->
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="fields2">
|
<dl class="fields2">
|
||||||
|
|
|
@ -34,34 +34,11 @@
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF -->
|
<!-- IF U_FIND_MEMBER and not S_SEARCH_USER --><a href="{U_FIND_MEMBER}">{L_FIND_USERNAME}</a> • <!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP --><a href="{U_HIDE_FIND_MEMBER}">{L_HIDE_MEMBER_SEARCH}</a> • <!-- ENDIF -->
|
||||||
<strong style="font-size: 0.95em;"><a href="{S_MODE_ACTION}&first_char=">{L_ALL}</a>
|
<strong style="font-size: 0.95em;">
|
||||||
<a href="{S_MODE_ACTION}&first_char=a#memberlist">A</a>
|
<!-- BEGIN first_char -->
|
||||||
<a href="{S_MODE_ACTION}&first_char=b#memberlist">B</a>
|
<a href="{first_char.U_SORT}">{first_char.DESC}</a>
|
||||||
<a href="{S_MODE_ACTION}&first_char=c#memberlist">C</a>
|
<!-- END first_char -->
|
||||||
<a href="{S_MODE_ACTION}&first_char=d#memberlist">D</a>
|
</strong>
|
||||||
<a href="{S_MODE_ACTION}&first_char=e#memberlist">E</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=f#memberlist">F</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=g#memberlist">G</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=h#memberlist">H</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=i#memberlist">I</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=j#memberlist">J</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=k#memberlist">K</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=l#memberlist">L</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=m#memberlist">M</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=n#memberlist">N</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=o#memberlist">O</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=p#memberlist">P</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=q#memberlist">Q</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=r#memberlist">R</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=s#memberlist">S</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=t#memberlist">T</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=u#memberlist">U</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=v#memberlist">V</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=w#memberlist">W</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=x#memberlist">X</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=y#memberlist">Y</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=z#memberlist">Z</a>
|
|
||||||
<a href="{S_MODE_ACTION}&first_char=other">#</a></strong>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="rightside pagination">
|
<li class="rightside pagination">
|
||||||
{TOTAL_USERS} •
|
{TOTAL_USERS} •
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
{META}
|
{META}
|
||||||
|
@ -80,16 +74,11 @@
|
||||||
|
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/styleswitcher.js"></script>
|
|
||||||
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
|
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
|
||||||
|
|
||||||
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
|
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
|
||||||
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
|
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
|
||||||
|
|
||||||
<link href="{T_THEME_PATH}/normal.css" rel="stylesheet" type="text/css" title="A" />
|
|
||||||
<link href="{T_THEME_PATH}/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
|
|
||||||
<link href="{T_THEME_PATH}/large.css" rel="alternate stylesheet" type="text/css" title="A++" />
|
|
||||||
|
|
||||||
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
|
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
|
||||||
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
|
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
@ -132,8 +121,6 @@
|
||||||
<ul class="linklist navlinks">
|
<ul class="linklist navlinks">
|
||||||
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a> <!-- BEGIN navlinks --> <strong>‹</strong> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></li>
|
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a> <!-- BEGIN navlinks --> <strong>‹</strong> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></li>
|
||||||
|
|
||||||
<li class="rightside"><a href="#" onclick="fontsizeup(); return false;" onkeypress="return fontsizeup(event);" class="fontsize" title="{L_CHANGE_FONT_SIZE}">{L_CHANGE_FONT_SIZE}</a></li>
|
|
||||||
|
|
||||||
<!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF -->
|
<!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF -->
|
||||||
<!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF -->
|
<!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF -->
|
||||||
<!-- IF U_PRINT_TOPIC --><li class="rightside"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p" class="print">{L_PRINT_TOPIC}</a></li><!-- ENDIF -->
|
<!-- IF U_PRINT_TOPIC --><li class="rightside"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p" class="print">{L_PRINT_TOPIC}</a></li><!-- ENDIF -->
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
a: '{LA_BBCODE_A_HELP}',
|
a: '{LA_BBCODE_A_HELP}',
|
||||||
s: '{LA_BBCODE_S_HELP}',
|
s: '{LA_BBCODE_S_HELP}',
|
||||||
f: '{LA_BBCODE_F_HELP}',
|
f: '{LA_BBCODE_F_HELP}',
|
||||||
e: '{LA_BBCODE_E_HELP}',
|
y: '{LA_BBCODE_Y_HELP}',
|
||||||
d: '{LA_BBCODE_D_HELP}'
|
d: '{LA_BBCODE_D_HELP}'
|
||||||
<!-- BEGIN custom_tags -->
|
<!-- BEGIN custom_tags -->
|
||||||
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
<input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}" />
|
<input type="button" class="button2" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" title="{L_BBCODE_C_HELP}" />
|
||||||
<input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}" />
|
<input type="button" class="button2" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" title="{L_BBCODE_L_HELP}" />
|
||||||
<input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}" />
|
<input type="button" class="button2" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" title="{L_BBCODE_O_HELP}" />
|
||||||
<input type="button" class="button2" accesskey="y" name="addlitsitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}" />
|
<input type="button" class="button2" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" title="{L_BBCODE_LISTITEM_HELP}" />
|
||||||
<!-- IF S_BBCODE_IMG -->
|
<!-- IF S_BBCODE_IMG -->
|
||||||
<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" />
|
<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
{META}
|
{META}
|
||||||
|
@ -46,16 +40,11 @@
|
||||||
|
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/styleswitcher.js"></script>
|
|
||||||
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
|
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
|
||||||
|
|
||||||
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
|
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
|
||||||
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
|
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
|
||||||
|
|
||||||
<link href="{T_THEME_PATH}/normal.css" rel="alternate stylesheet" type="text/css" title="A" />
|
|
||||||
<link href="{T_THEME_PATH}/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
|
|
||||||
<link href="{T_THEME_PATH}/large.css" rel="alternate stylesheet" type="text/css" title="A++" />
|
|
||||||
|
|
||||||
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
|
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
|
||||||
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
|
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -1,193 +0,0 @@
|
||||||
|
|
||||||
function fontsizeup(event)
|
|
||||||
{
|
|
||||||
// Skip tabs; 9 being the ASCII code for a tab
|
|
||||||
if (event && getKeyCode(event) == 9)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var active = getActiveStyleSheet();
|
|
||||||
|
|
||||||
switch (active)
|
|
||||||
{
|
|
||||||
case 'A--':
|
|
||||||
setActiveStyleSheet('A-');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A-':
|
|
||||||
setActiveStyleSheet('A');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A':
|
|
||||||
setActiveStyleSheet('A+');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A+':
|
|
||||||
setActiveStyleSheet('A++');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A++':
|
|
||||||
setActiveStyleSheet('A');
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
setActiveStyleSheet('A');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fontsizedown(event)
|
|
||||||
{
|
|
||||||
// Skip tabs
|
|
||||||
if (event && getKeyCode(event) == 9)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var active = getActiveStyleSheet();
|
|
||||||
|
|
||||||
switch (active)
|
|
||||||
{
|
|
||||||
case 'A++' :
|
|
||||||
setActiveStyleSheet('A+');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A+' :
|
|
||||||
setActiveStyleSheet('A');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A' :
|
|
||||||
setActiveStyleSheet('A-');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A-' :
|
|
||||||
setActiveStyleSheet('A--');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'A--' :
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
setActiveStyleSheet('A--');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeyCode(event)
|
|
||||||
{
|
|
||||||
// IE doesn't fire the onkeypress event for tabs
|
|
||||||
// Reference: http://www.quirksmode.org/js/keys.html
|
|
||||||
|
|
||||||
var code = (event.keyCode) ? event.keyCode : 0;
|
|
||||||
|
|
||||||
// Probably using FF
|
|
||||||
if (!code && event.charCode)
|
|
||||||
{
|
|
||||||
code = event.charCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActiveStyleSheet(title)
|
|
||||||
{
|
|
||||||
var i, a, main;
|
|
||||||
|
|
||||||
for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
|
|
||||||
{
|
|
||||||
if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title'))
|
|
||||||
{
|
|
||||||
a.disabled = true;
|
|
||||||
if (a.getAttribute('title') == title)
|
|
||||||
{
|
|
||||||
a.disabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActiveStyleSheet()
|
|
||||||
{
|
|
||||||
var i, a;
|
|
||||||
|
|
||||||
for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
|
|
||||||
{
|
|
||||||
if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled)
|
|
||||||
{
|
|
||||||
return a.getAttribute('title');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPreferredStyleSheet()
|
|
||||||
{
|
|
||||||
return ('A-');
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCookie(name, value, days)
|
|
||||||
{
|
|
||||||
if (days)
|
|
||||||
{
|
|
||||||
var date = new Date();
|
|
||||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
|
||||||
var expires = '; expires=' + date.toGMTString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
expires = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.cookie = name + '=' + value + expires + style_cookie_settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
function readCookie(name)
|
|
||||||
{
|
|
||||||
var nameEQ = name + '=';
|
|
||||||
var ca = document.cookie.split(';');
|
|
||||||
|
|
||||||
for (var i = 0; i < ca.length; i++)
|
|
||||||
{
|
|
||||||
var c = ca[i];
|
|
||||||
|
|
||||||
while (c.charAt(0) == ' ')
|
|
||||||
{
|
|
||||||
c = c.substring(1, c.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c.indexOf(nameEQ) == 0)
|
|
||||||
{
|
|
||||||
return c.substring(nameEQ.length, c.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function load_cookie()
|
|
||||||
{
|
|
||||||
var cookie = readCookie('style_cookie');
|
|
||||||
var title = cookie ? cookie : getPreferredStyleSheet();
|
|
||||||
setActiveStyleSheet(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unload_cookie()
|
|
||||||
{
|
|
||||||
var title = getActiveStyleSheet();
|
|
||||||
createCookie('style_cookie', title, 365);
|
|
||||||
}
|
|
||||||
|
|
||||||
onload_functions.push('load_cookie()');
|
|
||||||
onunload_functions.push('unload_cookie()');
|
|
||||||
|
|
||||||
/*
|
|
||||||
var cookie = readCookie("style");
|
|
||||||
var title = cookie ? cookie : getPreferredStyleSheet();
|
|
||||||
setActiveStyleSheet(title);
|
|
||||||
*/
|
|
|
@ -1,9 +1,6 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
<ul class="topiclist">
|
<ul class="topiclist">
|
||||||
<li class="header">
|
<li class="header">
|
||||||
<dl class="icon">
|
<dl class="icon">
|
||||||
<dt><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></dt>
|
<dt><div class="wrap-content"><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></div></dt>
|
||||||
<dd class="posts">{L_REPLIES}</dd>
|
<dd class="posts">{L_REPLIES}</dd>
|
||||||
<dd class="views">{L_VIEWS}</dd>
|
<dd class="views">{L_VIEWS}</dd>
|
||||||
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
|
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
|
||||||
|
@ -139,13 +139,13 @@
|
||||||
|
|
||||||
<li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">
|
<li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">
|
||||||
<dl class="icon {topicrow.TOPIC_IMG_STYLE}">
|
<dl class="icon {topicrow.TOPIC_IMG_STYLE}">
|
||||||
<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"><div class="wrap-content"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
|
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
|
||||||
<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
|
<!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
|
||||||
<!-- IF topicrow.PAGINATION --><strong class="pagination"><span>{topicrow.PAGINATION}</span></strong><!-- ENDIF -->
|
<!-- IF topicrow.PAGINATION --><strong class="pagination"><span>{topicrow.PAGINATION}</span></strong><!-- ENDIF -->
|
||||||
<!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF -->{L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME}
|
<!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF -->{L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME}
|
||||||
<!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF -->
|
<!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF -->
|
||||||
</dt>
|
</div></dt>
|
||||||
<dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
<dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||||
<dd class="views">{topicrow.VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
<dd class="views">{topicrow.VIEWS} <dfn>{L_VIEWS}</dfn></dd>
|
||||||
<dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}
|
<dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
|
|
|
@ -491,7 +491,7 @@
|
||||||
|
|
||||||
/* Sub-header (navigation bar)
|
/* Sub-header (navigation bar)
|
||||||
--------------------------------------------- */
|
--------------------------------------------- */
|
||||||
.rtl a.print, .rtl a.sendemail, .rtl a.fontsize {
|
.rtl a.print, .rtl a.sendemail {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
/* Sub-header (navigation bar)
|
/* Sub-header (navigation bar)
|
||||||
--------------------------------------------- */
|
--------------------------------------------- */
|
||||||
a.print, a.sendemail, a.fontsize {
|
a.print, a.sendemail {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
|
@ -70,17 +70,6 @@ a.sendemail {
|
||||||
width: 22px;
|
width: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.fontsize {
|
|
||||||
background-image: none;
|
|
||||||
background-position: 0 -1px;
|
|
||||||
width: 29px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.fontsize:hover {
|
|
||||||
background-position: 0 -20px;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Icon images
|
/* Icon images
|
||||||
---------------------------------------- */
|
---------------------------------------- */
|
||||||
.sitehome, .icon-faq, .icon-members, .icon-home, .icon-ucp, .icon-register, .icon-logout,
|
.sitehome, .icon-faq, .icon-members, .icon-home, .icon-ucp, .icon-register, .icon-logout,
|
||||||
|
|
|
@ -676,10 +676,6 @@ a.sendemail {
|
||||||
background-image: url("{T_THEME_PATH}/images/icon_sendemail.gif");
|
background-image: url("{T_THEME_PATH}/images/icon_sendemail.gif");
|
||||||
}
|
}
|
||||||
|
|
||||||
a.fontsize {
|
|
||||||
background-image: url("{T_THEME_PATH}/images/icon_fontsize.gif");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Icon images
|
/* Icon images
|
||||||
---------------------------------------- */
|
---------------------------------------- */
|
||||||
.sitehome { background-image: url("{T_THEME_PATH}/images/icon_home.gif"); }
|
.sitehome { background-image: url("{T_THEME_PATH}/images/icon_home.gif"); }
|
||||||
|
|
|
@ -29,10 +29,15 @@ ul.topiclist li.row dl {
|
||||||
ul.topiclist dt {
|
ul.topiclist dt {
|
||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
width: 50%;
|
width: 100%;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
margin-right: -465px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.topiclist dt .wrap-content {
|
||||||
|
padding-right: 465px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.topiclist dd {
|
ul.topiclist dd {
|
||||||
|
@ -96,6 +101,7 @@ li.header dt, li.header dd {
|
||||||
|
|
||||||
li.header dt {
|
li.header dt {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
margin-right: -465px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.header dd {
|
li.header dd {
|
||||||
|
@ -126,7 +132,7 @@ dl.icon dt {
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.posts, dd.topics, dd.views {
|
dd.posts, dd.topics, dd.views {
|
||||||
width: 8%;
|
width: 90px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 2.2em;
|
line-height: 2.2em;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
@ -145,7 +151,7 @@ dl.icon dt li {
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.lastpost {
|
dd.lastpost {
|
||||||
width: 25%;
|
width: 230px;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 559 B |
|
@ -1,3 +0,0 @@
|
||||||
body {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
body {
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
body {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
|
@ -72,7 +72,7 @@
|
||||||
<param name="controller" value="true">
|
<param name="controller" value="true">
|
||||||
<param name="autoplay" value="false" />
|
<param name="autoplay" value="false" />
|
||||||
<param name="type" value="video/quicktime">
|
<param name="type" value="video/quicktime">
|
||||||
<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false">
|
<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false"></embed>
|
||||||
</object>
|
</object>
|
||||||
<!-- ELSEIF _file.S_RM_FILE -->
|
<!-- ELSEIF _file.S_RM_FILE -->
|
||||||
<object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50">
|
<object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50">
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
<span class="gen"><br />{L_SELECT_DESTINATION_FORUM} </span>
|
<span class="gen"><br />{L_SELECT_DESTINATION_FORUM} </span>
|
||||||
<select name="to_forum_id">{S_FORUM_SELECT}</select><br />
|
<select name="to_forum_id">{S_FORUM_SELECT}</select><br />
|
||||||
<!-- IF S_CAN_LEAVE_SHADOW -->
|
<!-- IF S_CAN_LEAVE_SHADOW -->
|
||||||
<input type="checkbox" class="radio" name="move_leave_shadow" checked="checked" /><span class="gen">{L_LEAVE_SHADOW}</span><br />
|
<input type="checkbox" class="radio" name="move_leave_shadow" /><span class="gen">{L_LEAVE_SHADOW}</span><br />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF S_CAN_LOCK_TOPIC -->
|
<!-- IF S_CAN_LOCK_TOPIC -->
|
||||||
<input type="checkbox" class="radio" name="move_lock_topics" checked="checked" /><span class="gen">{L_LOCK_TOPIC}</span><br />
|
<input type="checkbox" class="radio" name="move_lock_topics" /><span class="gen">{L_LOCK_TOPIC}</span><br />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<br />{S_HIDDEN_FIELDS}<span class="gen">{MESSAGE_TEXT}</span><br /><br />
|
<br />{S_HIDDEN_FIELDS}<span class="gen">{MESSAGE_TEXT}</span><br /><br />
|
||||||
<input type="submit" name="confirm" value="{YES_VALUE}" class="btnmain" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" />
|
<input type="submit" name="confirm" value="{YES_VALUE}" class="btnmain" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" />
|
||||||
|
|
|
@ -14,7 +14,12 @@
|
||||||
<form method="post" name="charsearch" action="{S_MODE_ACTION}">
|
<form method="post" name="charsearch" action="{S_MODE_ACTION}">
|
||||||
<table width="100%" cellspacing="1">
|
<table width="100%" cellspacing="1">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="{S_CONTENT_FLOW_BEGIN}"><span class="genmed">{L_USERNAME_BEGINS_WITH}: </span><select name="first_char" onchange="this.form.submit();">{S_CHAR_OPTIONS}</select> <input type="submit" name="char" value="{L_DISPLAY}" class="btnlite" /></td>
|
<td align="{S_CONTENT_FLOW_BEGIN}"><span class="genmed">{L_USERNAME_BEGINS_WITH}: </span>
|
||||||
|
<select name="first_char" onchange="this.form.submit();">
|
||||||
|
<!-- BEGIN first_char -->
|
||||||
|
<option value="{first_char.VALUE}"<!-- IF first_char.S_SELECTED --> selected="selected"<!-- ENDIF -->>{first_char.DESC}</option>
|
||||||
|
<!-- END first_char -->
|
||||||
|
</select> <input type="submit" name="char" value="{L_DISPLAY}" class="btnlite" /></td>
|
||||||
<!-- IF U_FIND_MEMBER and not S_SEARCH_USER -->
|
<!-- IF U_FIND_MEMBER and not S_SEARCH_USER -->
|
||||||
<td class="genmed" align="{S_CONTENT_FLOW_END}"><a href="{U_FIND_MEMBER}">{L_FIND_USERNAME}</a></td>
|
<td class="genmed" align="{S_CONTENT_FLOW_END}"><a href="{U_FIND_MEMBER}">{L_FIND_USERNAME}</a></td>
|
||||||
<!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP -->
|
<!-- ELSEIF S_SEARCH_USER and U_HIDE_FIND_MEMBER and not S_IN_SEARCH_POPUP -->
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
{META}
|
{META}
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
a: '{LA_BBCODE_A_HELP}',
|
a: '{LA_BBCODE_A_HELP}',
|
||||||
s: '{LA_BBCODE_S_HELP}',
|
s: '{LA_BBCODE_S_HELP}',
|
||||||
f: '{LA_BBCODE_F_HELP}',
|
f: '{LA_BBCODE_F_HELP}',
|
||||||
e: '{LA_BBCODE_E_HELP}',
|
y: '{LA_BBCODE_Y_HELP}',
|
||||||
d: '{LA_BBCODE_D_HELP}',
|
d: '{LA_BBCODE_D_HELP}',
|
||||||
t: '{LA_BBCODE_T_HELP}',
|
|
||||||
tip: '{L_STYLES_TIP}'
|
tip: '{L_STYLES_TIP}'
|
||||||
<!-- BEGIN custom_tags -->
|
<!-- BEGIN custom_tags -->
|
||||||
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
,cb_{custom_tags.BBCODE_ID}: '{custom_tags.A_BBCODE_HELPLINE}'
|
||||||
|
@ -45,7 +44,7 @@
|
||||||
<input type="button" class="btnbbcode" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
|
<input type="button" class="btnbbcode" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="btnbbcode" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" />
|
<input type="button" class="btnbbcode" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="btnbbcode" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" />
|
<input type="button" class="btnbbcode" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" onmouseout="helpline('tip')" />
|
||||||
<input type="button" class="btnbbcode" accesskey="y" name="addlitsitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('e')" onmouseout="helpline('tip')" />
|
<input type="button" class="btnbbcode" accesskey="y" name="addlistitem" value="[*]" style="width: 40px" onclick="bbstyle(-1)" onmouseover="helpline('e')" onmouseout="helpline('tip')" />
|
||||||
<!-- IF S_BBCODE_IMG -->
|
<!-- IF S_BBCODE_IMG -->
|
||||||
<input type="button" class="btnbbcode" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
|
<input type="button" class="btnbbcode" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
|
|
||||||
<meta http-equiv="content-language" content="{S_USER_LANG}" />
|
|
||||||
<meta http-equiv="content-style-type" content="text/css" />
|
|
||||||
<meta http-equiv="imagetoolbar" content="no" />
|
|
||||||
<meta name="resource-type" content="document" />
|
|
||||||
<meta name="distribution" content="global" />
|
|
||||||
<meta name="keywords" content="" />
|
<meta name="keywords" content="" />
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
{META}
|
{META}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}">
|
|
||||||
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE html>
|
||||||
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
<html dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
||||||
<meta http-equiv="Content-Language" content="{S_USER_LANG}">
|
|
||||||
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
<title>{SITENAME} :: {PAGE_TITLE}</title>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
|
@ -212,7 +212,7 @@ $s_watching_forum = array(
|
||||||
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && $auth->acl_get('f_subscribe', $forum_id))
|
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && $auth->acl_get('f_subscribe', $forum_id))
|
||||||
{
|
{
|
||||||
$notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL;
|
$notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL;
|
||||||
watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status);
|
watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$s_forum_rules = '';
|
$s_forum_rules = '';
|
||||||
|
|
|
@ -377,7 +377,7 @@ if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
|
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
WHERE group_legend = > 0
|
WHERE group_legend > 0
|
||||||
ORDER BY ' . $order_legend . ' ASC';
|
ORDER BY ' . $order_legend . ' ASC';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -175,7 +175,7 @@ $sql_array = array(
|
||||||
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
|
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
|
||||||
if ($post_id)
|
if ($post_id)
|
||||||
{
|
{
|
||||||
$sql_array['SELECT'] .= ', p.post_approved';
|
$sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id';
|
||||||
$sql_array['FROM'][POSTS_TABLE] = 'p';
|
$sql_array['FROM'][POSTS_TABLE] = 'p';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,12 +275,19 @@ if ($post_id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(p1.post_id) AS prev_posts
|
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
|
||||||
FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2
|
FROM ' . POSTS_TABLE . " p
|
||||||
WHERE p1.topic_id = {$topic_data['topic_id']}
|
WHERE p.topic_id = {$topic_data['topic_id']}
|
||||||
AND p2.post_id = {$post_id}
|
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '');
|
||||||
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . '
|
|
||||||
AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time');
|
if ($sort_dir == 'd')
|
||||||
|
{
|
||||||
|
$sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))";
|
||||||
|
}
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
@ -449,7 +456,7 @@ $s_watching_topic = array(
|
||||||
|
|
||||||
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'])
|
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start);
|
watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start, $topic_data['topic_title']);
|
||||||
|
|
||||||
// Reset forum notification if forum notify is set
|
// Reset forum notification if forum notify is set
|
||||||
if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id))
|
if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id))
|
||||||
|
@ -956,7 +963,7 @@ $sql = $db->sql_build_query('SELECT', array(
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
|
||||||
|
|
||||||
// Posts are stored in the $rowset array while $attach_list, $user_cache
|
// Posts are stored in the $rowset array while $attach_list, $user_cache
|
||||||
// and the global bbcode_bitfield are built
|
// and the global bbcode_bitfield are built
|
||||||
|
@ -1303,7 +1310,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row =& $rowset[$post_list[$i]];
|
$row = $rowset[$post_list[$i]];
|
||||||
$poster_id = $row['user_id'];
|
$poster_id = $row['user_id'];
|
||||||
|
|
||||||
// End signature parsing, only if needed
|
// End signature parsing, only if needed
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue