mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'develop' into feature/avatars
* develop: (335 commits) [ticket/10575] Adding public visibility to the methods. [ticket/10575] Fixing non-static access to static functions get_instance [ticket/10547] User is not logged in as admin after installation [ticket/10650] Revert merge of 'rahulr92/ticket/10650' into develop [ticket/10650] Added checking for empty subjects [ticket/10650] Corrected intendation [ticket/10650]Added permission checking and utf8 functions [ticket/10650] Cropped subject and inserted newline [ticket/10650] Corrected space before true [ticket/10650] Changed language files and forumlist [ticket/10650] Added static sql files [ticket/10650] Displaying last topic on forum list [ticket/10760] Fix numbering in php fun facts. [ticket/10760] Value must be quoted as it might be two words. [ticket/10760] PHP is great. This commit is the proof. [ticket/10760] Catch both versions of parse error output in php. [ticket/10607] Added 'Powered by' translation string. [ticket/10760] Account for display_errors=stderr in pre-commit hook. [ticket/10760] Quote PHP_BIN when using it. [ticket/10760] Use echo -e only if echo understands -e. ...
This commit is contained in:
commit
24daef1aaf
211 changed files with 6195 additions and 5891 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -3,12 +3,16 @@
|
||||||
/phpBB/cache/*.html
|
/phpBB/cache/*.html
|
||||||
/phpBB/cache/*.php
|
/phpBB/cache/*.php
|
||||||
/phpBB/cache/queue.php.lock
|
/phpBB/cache/queue.php.lock
|
||||||
|
/phpBB/composer.phar
|
||||||
/phpBB/config.php
|
/phpBB/config.php
|
||||||
|
/phpBB/config_dev.php
|
||||||
|
/phpBB/config_test.php
|
||||||
/phpBB/ext/*
|
/phpBB/ext/*
|
||||||
/phpBB/files/*
|
/phpBB/files/*
|
||||||
/phpBB/images/avatars/gallery/*
|
/phpBB/images/avatars/gallery/*
|
||||||
/phpBB/images/avatars/upload/*
|
/phpBB/images/avatars/upload/*
|
||||||
/phpBB/store/*
|
/phpBB/store/*
|
||||||
|
/phpBB/vendor
|
||||||
/tests/phpbb_unit_tests.sqlite2
|
/tests/phpbb_unit_tests.sqlite2
|
||||||
/tests/test_config.php
|
/tests/test_config.php
|
||||||
/tests/tmp/*
|
/tests/tmp/*
|
||||||
|
|
29
.travis.yml
Normal file
29
.travis.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
language: php
|
||||||
|
php:
|
||||||
|
- 5.3.2
|
||||||
|
- 5.4
|
||||||
|
|
||||||
|
env:
|
||||||
|
- DB=mysql
|
||||||
|
- DB=postgres
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database phpbb_tests;' -U postgres; fi"
|
||||||
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS phpbb_tests;'; fi"
|
||||||
|
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; else pyrus install --force phpunit/DbUnit; fi"
|
||||||
|
- phpenv rehash
|
||||||
|
- cd phpBB
|
||||||
|
- curl -s http://getcomposer.org/installer | php
|
||||||
|
- php composer.phar install
|
||||||
|
- cd ../
|
||||||
|
|
||||||
|
script:
|
||||||
|
- phpunit --configuration travis/phpunit-$DB-travis.xml
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
recipients:
|
||||||
|
- dev-team@phpbb.com
|
||||||
|
on_success: change
|
||||||
|
on_failure: change
|
15
README.md
15
README.md
|
@ -8,6 +8,15 @@ phpBB is a free bulletin board written in PHP.
|
||||||
|
|
||||||
Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the development on [area51](http://area51.phpbb.com/phpBB/index.php).
|
Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the development on [area51](http://area51.phpbb.com/phpBB/index.php).
|
||||||
|
|
||||||
|
## INSTALLING DEPENDENCIES
|
||||||
|
|
||||||
|
To be able to run an installation from the repo (and not from a pre-built package) you need to run the following commands to install phpBB's dependencies.
|
||||||
|
|
||||||
|
cd phpBB
|
||||||
|
curl -s http://getcomposer.org/installer | php
|
||||||
|
php composer.phar install
|
||||||
|
|
||||||
|
|
||||||
## CONTRIBUTE
|
## CONTRIBUTE
|
||||||
|
|
||||||
1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register)
|
1. [Create an account on phpBB.com](http://www.phpbb.com/community/ucp.php?mode=register)
|
||||||
|
@ -15,6 +24,12 @@ Find support and lots more on [phpBB.com](http://www.phpbb.com)! Discuss the dev
|
||||||
3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git)
|
3. [Read our Git Contribution Guidelines](http://wiki.phpbb.com/Git); if you're new to git, also read [the introduction guide](http://wiki.phpbb.com/display/DEV/Working+with+Git)
|
||||||
4. Send us a pull request
|
4. Send us a pull request
|
||||||
|
|
||||||
|
## AUTOMATED TESTING
|
||||||
|
|
||||||
|
We have unit and functional tests in order to prevent regressions. You can view the bamboo continuous integration [here](http://bamboo.phpbb.com) or check our travis build below.
|
||||||
|
develop - [](http://travis-ci.org/phpbb/phpbb3)
|
||||||
|
develop-olympus - [](http://travis-ci.org/phpbb/phpbb3)
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
||||||
[GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php)
|
[GNU General Public License v2](http://opensource.org/licenses/gpl-2.0.php)
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
<property name="versions" value="${oldversions}, ${newversion}" />
|
<property name="versions" value="${oldversions}, ${newversion}" />
|
||||||
|
|
||||||
<!-- These are the main targets which you will probably want to use -->
|
<!-- These are the main targets which you will probably want to use -->
|
||||||
<target name="package" depends="clean,prepare,create-package" />
|
<target name="package" depends="clean,prepare,composer,create-package" />
|
||||||
<target name="all" depends="clean,prepare,test,docs,create-package" />
|
<target name="all" depends="clean,prepare,composer,test,docs,create-package" />
|
||||||
<target name="build" depends="clean,prepare,test,docs" />
|
<target name="build" depends="clean,prepare,composer,test,docs" />
|
||||||
|
|
||||||
<target name="prepare">
|
<target name="prepare">
|
||||||
<mkdir dir="build/logs" />
|
<mkdir dir="build/logs" />
|
||||||
|
@ -43,7 +43,19 @@
|
||||||
<delete dir="build/save" />
|
<delete dir="build/save" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test" depends="clean,prepare">
|
<target name="composer" depends="clean,prepare">
|
||||||
|
<exec dir="./phpBB/"
|
||||||
|
command="curl -s http://getcomposer.org/installer | php"
|
||||||
|
passthru="true" />
|
||||||
|
<exec dir="./phpBB/"
|
||||||
|
command="php composer.phar install"
|
||||||
|
passthru="true" />
|
||||||
|
<exec dir="./phpBB/"
|
||||||
|
command="rm composer.phar"
|
||||||
|
passthru="true" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="test" depends="clean,prepare,composer">
|
||||||
<exec dir="."
|
<exec dir="."
|
||||||
command="phpunit --log-junit build/logs/phpunit.xml
|
command="phpunit --log-junit build/logs/phpunit.xml
|
||||||
--coverage-clover build/logs/clover.xml
|
--coverage-clover build/logs/clover.xml
|
||||||
|
@ -51,7 +63,7 @@
|
||||||
passthru="true" />
|
passthru="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="test-slow" depends="clean,prepare">
|
<target name="test-slow" depends="clean,prepare,composer">
|
||||||
<exec dir="."
|
<exec dir="."
|
||||||
command="phpunit --log-junit build/logs/phpunit.xml
|
command="phpunit --log-junit build/logs/phpunit.xml
|
||||||
--configuration phpunit.xml.all
|
--configuration phpunit.xml.all
|
||||||
|
@ -155,6 +167,17 @@
|
||||||
<exec dir="phpBB"
|
<exec dir="phpBB"
|
||||||
command="git archive ${revision} | tar -xf - -C ../${dir}"
|
command="git archive ${revision} | tar -xf - -C ../${dir}"
|
||||||
checkreturn="true" />
|
checkreturn="true" />
|
||||||
|
|
||||||
|
<exec dir="${dir}"
|
||||||
|
command="curl -s http://getcomposer.org/installer | php"
|
||||||
|
passthru="true" />
|
||||||
|
<exec dir="${dir}"
|
||||||
|
command="php composer.phar install"
|
||||||
|
passthru="true" />
|
||||||
|
<exec dir="${dir}"
|
||||||
|
command="rm composer.phar"
|
||||||
|
passthru="true" />
|
||||||
|
|
||||||
<delete file="${dir}/config.php" />
|
<delete file="${dir}/config.php" />
|
||||||
<delete dir="${dir}/develop" />
|
<delete dir="${dir}/develop" />
|
||||||
<delete dir="${dir}/install/data" />
|
<delete dir="${dir}/install/data" />
|
||||||
|
|
|
@ -12,8 +12,17 @@
|
||||||
# ln -s ../../git-tools/hooks/pre-commit \\
|
# ln -s ../../git-tools/hooks/pre-commit \\
|
||||||
# .git/hooks/pre-commit
|
# .git/hooks/pre-commit
|
||||||
|
|
||||||
# NOTE: this is run through /usr/bin/env
|
if [ -z "$PHP_BIN" ]
|
||||||
|
then
|
||||||
PHP_BIN=php
|
PHP_BIN=php
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(echo -e test)" = test ]
|
||||||
|
then
|
||||||
|
echo_e="echo -e"
|
||||||
|
else
|
||||||
|
echo_e="echo"
|
||||||
|
fi
|
||||||
|
|
||||||
# necessary check for initial commit
|
# necessary check for initial commit
|
||||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||||
|
@ -27,7 +36,7 @@ fi
|
||||||
error=0
|
error=0
|
||||||
errors=""
|
errors=""
|
||||||
|
|
||||||
if ! which $PHP_BIN >/dev/null 2>&1
|
if ! which "$PHP_BIN" >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
echo "PHP Syntax check failed:"
|
echo "PHP Syntax check failed:"
|
||||||
echo "PHP binary does not exist or is not in path: $PHP_BIN"
|
echo "PHP binary does not exist or is not in path: $PHP_BIN"
|
||||||
|
@ -64,7 +73,13 @@ do
|
||||||
|
|
||||||
# check the staged file content for syntax errors
|
# check the staged file content for syntax errors
|
||||||
# using php -l (lint)
|
# using php -l (lint)
|
||||||
result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null)
|
# note: if display_errors=stderr in php.ini,
|
||||||
|
# parse errors are printed on stderr; otherwise
|
||||||
|
# they are printed on stdout.
|
||||||
|
# we filter everything other than parse errors
|
||||||
|
# with a grep below, therefore it should be safe
|
||||||
|
# to combine stdout and stderr in all circumstances
|
||||||
|
result=$(git cat-file -p $sha | "$PHP_BIN" -l 2>&1)
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
error=1
|
error=1
|
||||||
|
@ -76,7 +91,45 @@ unset IFS
|
||||||
|
|
||||||
if [ $error -eq 1 ]
|
if [ $error -eq 1 ]
|
||||||
then
|
then
|
||||||
echo -e "PHP Syntax check failed:";
|
echo "PHP Syntax check failed:"
|
||||||
echo -e "$errors" | grep "^Parse error:"
|
# php "display errors" (display_errors php.ini value)
|
||||||
|
# and "log errors" (log_errors php.ini value).
|
||||||
|
# these are independent settings - see main/main.c in php source.
|
||||||
|
# the "log errors" setting produces output which
|
||||||
|
# starts with "PHP Parse error:"; the "display errors"
|
||||||
|
# setting produces output starting with "Parse error:".
|
||||||
|
# if both are turned on php dumps the parse error twice.
|
||||||
|
# therefore here we try to grep for one version and
|
||||||
|
# if that yields no results grep for the other version.
|
||||||
|
#
|
||||||
|
# other fun php facts:
|
||||||
|
#
|
||||||
|
# 1. in cli, display_errors and log_errors have different
|
||||||
|
# destinations by default. display_errors prints to
|
||||||
|
# standard output and log_errors prints to standard error.
|
||||||
|
# whether these destinations make sense is left
|
||||||
|
# as an exercise for the reader.
|
||||||
|
# 2. as mentioned above, with all output turned on
|
||||||
|
# php will print parse errors twice, one time on stdout
|
||||||
|
# and one time on stderr.
|
||||||
|
# 3. it is possible to set both display_errors and log_errors
|
||||||
|
# to off. if this is done php will print the text
|
||||||
|
# "Errors parsing <file>" but will not say what
|
||||||
|
# the errors are. useful behavior, this.
|
||||||
|
# 4. on my system display_errors defaults to on and
|
||||||
|
# log_errors defaults to off, therefore providing
|
||||||
|
# by default one copy of messages. your mileage may vary.
|
||||||
|
# 5. by setting display_errors=stderr and log_errors=on,
|
||||||
|
# both sets of messages will be printed on stderr.
|
||||||
|
# 6. php-cgi binary, given display_errors=stderr and
|
||||||
|
# log_errors=on, still prints both sets of messages
|
||||||
|
# on stderr, but formats one set as an html fragment.
|
||||||
|
# 7. your entry here? ;)
|
||||||
|
$echo_e "$errors" | grep "^Parse error:"
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
# match failed
|
||||||
|
$echo_e "$errors" | grep "^PHP Parse error:"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
BIN
phpBB/adm/images/alert_close.png
Normal file
BIN
phpBB/adm/images/alert_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -50,9 +50,9 @@ $file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_up
|
||||||
$module_id = request_var('i', '');
|
$module_id = request_var('i', '');
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
|
|
||||||
// Set custom template for admin area
|
// Set custom style for admin area
|
||||||
$template->set_ext_dir_prefix('adm/');
|
$style->set_ext_dir_prefix('adm/');
|
||||||
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
|
$style->set_custom_style('admin', $phpbb_admin_path . 'style', '');
|
||||||
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
|
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
|
||||||
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@
|
||||||
<!-- ELSE --><br /><span>» {L_ALLOWED_IN_PM_POST}</span><!-- ENDIF -->
|
<!-- ELSE --><br /><span>» {L_ALLOWED_IN_PM_POST}</span><!-- ENDIF -->
|
||||||
</td>
|
</td>
|
||||||
<td>{groups.CATEGORY}</td>
|
<td>{groups.CATEGORY}</td>
|
||||||
<td align="center" valign="middle" style="white-space: nowrap;"> <a href="{groups.U_EDIT}">{ICON_EDIT}</a> <a href="{groups.U_DELETE}">{ICON_DELETE}</a> </td>
|
<td align="center" valign="middle" style="white-space: nowrap;"> <a href="{groups.U_EDIT}">{ICON_EDIT}</a> <a href="{groups.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END groups -->
|
<!-- END groups -->
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<!-- BEGIN bbcodes -->
|
<!-- BEGIN bbcodes -->
|
||||||
<!-- IF bbcodes.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
<!-- IF bbcodes.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||||
<td style="text-align: center;">{bbcodes.BBCODE_TAG}</td>
|
<td style="text-align: center;">{bbcodes.BBCODE_TAG}</td>
|
||||||
<td style="text-align: right; width: 40px;"><a href="{bbcodes.U_EDIT}">{ICON_EDIT}</a> <a href="{bbcodes.U_DELETE}">{ICON_DELETE}</a></td>
|
<td style="text-align: right; width: 40px;"><a href="{bbcodes.U_EDIT}">{ICON_EDIT}</a> <a href="{bbcodes.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
<tr class="row3">
|
<tr class="row3">
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
<!-- IF bots.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
<!-- IF bots.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||||
<td style="width: 50%;">{bots.BOT_NAME}</td>
|
<td style="width: 50%;">{bots.BOT_NAME}</td>
|
||||||
<td style="width: 15%; white-space: nowrap;" align="center"> {bots.LAST_VISIT} </td>
|
<td style="width: 15%; white-space: nowrap;" align="center"> {bots.LAST_VISIT} </td>
|
||||||
<td style="text-align: center;"> <a href="{bots.U_ACTIVATE_DEACTIVATE}">{bots.L_ACTIVATE_DEACTIVATE}</a> </td>
|
<td style="text-align: center;"> <a href="{bots.U_ACTIVATE_DEACTIVATE}" data-ajax="activate_deactivate">{bots.L_ACTIVATE_DEACTIVATE}</a> </td>
|
||||||
<td style="text-align: center;"> <a href="{bots.U_EDIT}">{L_EDIT}</a> </td>
|
<td style="text-align: center;"> <a href="{bots.U_EDIT}">{L_EDIT}</a> </td>
|
||||||
<td style="text-align: center;"> <a href="{bots.U_DELETE}">{L_DELETE}</a> </td>
|
<td style="text-align: center;"> <a href="{bots.U_DELETE}" data-ajax="row_delete">{L_DELETE}</a> </td>
|
||||||
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{bots.BOT_ID}" /></td>
|
<td style="text-align: center;"><input type="checkbox" class="radio" name="mark[]" value="{bots.BOT_ID}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END bots -->
|
<!-- END bots -->
|
||||||
|
|
|
@ -443,7 +443,7 @@
|
||||||
<col class="row1" /><col class="row1" /><col class="row2" />
|
<col class="row1" /><col class="row1" /><col class="row2" />
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- BEGIN forums -->
|
<!-- BEGIN forums -->
|
||||||
<tr>
|
<tr data-down="{forums.U_MOVE_DOWN}" data-up="{forums.U_MOVE_UP}">
|
||||||
<td style="width: 5%; text-align: center;">{forums.FOLDER_IMAGE}</td>
|
<td style="width: 5%; text-align: center;">{forums.FOLDER_IMAGE}</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- IF forums.FORUM_IMAGE --><div style="float: {S_CONTENT_FLOW_BEGIN}; margin-right: 5px;">{forums.FORUM_IMAGE}</div><!-- ENDIF -->
|
<!-- IF forums.FORUM_IMAGE --><div style="float: {S_CONTENT_FLOW_BEGIN}; margin-right: 5px;">{forums.FORUM_IMAGE}</div><!-- ENDIF -->
|
||||||
|
@ -453,17 +453,17 @@
|
||||||
</td>
|
</td>
|
||||||
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
|
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
|
||||||
<!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
<!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
||||||
{ICON_MOVE_UP_DISABLED}
|
<span class="up">{ICON_MOVE_UP_DISABLED}</span>
|
||||||
<a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
|
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down">{ICON_MOVE_DOWN}</a></span>
|
||||||
<!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
<!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
||||||
<a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a>
|
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up">{ICON_MOVE_UP}</a></span>
|
||||||
<a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
|
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down">{ICON_MOVE_DOWN}</a></span>
|
||||||
<!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW -->
|
<!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW -->
|
||||||
<a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a>
|
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up">{ICON_MOVE_UP}</a></span>
|
||||||
{ICON_MOVE_DOWN_DISABLED}
|
<span class="down">{ICON_MOVE_DOWN_DISABLED}</span>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
{ICON_MOVE_UP_DISABLED}
|
<span class="up">{ICON_MOVE_UP_DISABLED}</span>
|
||||||
{ICON_MOVE_DOWN_DISABLED}
|
<span class="down">{ICON_MOVE_DOWN_DISABLED}</span>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{forums.U_EDIT}">{ICON_EDIT}</a>
|
<a href="{forums.U_EDIT}">{ICON_EDIT}</a>
|
||||||
<!-- IF not forums.S_FORUM_LINK -->
|
<!-- IF not forums.S_FORUM_LINK -->
|
||||||
|
@ -500,6 +500,14 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class="hidden">
|
||||||
|
<a class="template-up-img" href="#">{ICON_MOVE_UP}</a>
|
||||||
|
<span class="template-up-img-disabled">{ICON_MOVE_UP_DISABLED}</span>
|
||||||
|
|
||||||
|
<a class="template-down-img" href="#">{ICON_MOVE_DOWN}</a>
|
||||||
|
<span class="template-down-img-disabled">{ICON_MOVE_DOWN_DISABLED}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!-- INCLUDE overall_footer.html -->
|
<!-- INCLUDE overall_footer.html -->
|
||||||
|
|
|
@ -330,7 +330,7 @@
|
||||||
<td style="text-align: center;">{groups.TOTAL_MEMBERS}</td>
|
<td style="text-align: center;">{groups.TOTAL_MEMBERS}</td>
|
||||||
<td style="text-align: center;"><a href="{groups.U_EDIT}">{L_SETTINGS}</a></td>
|
<td style="text-align: center;"><a href="{groups.U_EDIT}">{L_SETTINGS}</a></td>
|
||||||
<td style="text-align: center;"><a href="{groups.U_LIST}">{L_MEMBERS}</a></td>
|
<td style="text-align: center;"><a href="{groups.U_LIST}">{L_MEMBERS}</a></td>
|
||||||
<td style="text-align: center;"><!-- IF not groups.S_GROUP_SPECIAL and groups.U_DELETE --><a href="{groups.U_DELETE}">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
<td style="text-align: center;"><!-- IF not groups.S_GROUP_SPECIAL and groups.U_DELETE --><a href="{groups.U_DELETE}" data-ajax="row_delete">{L_DELETE}</a><!-- ELSE -->{L_DELETE}<!-- ENDIF --></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- END groups -->
|
<!-- END groups -->
|
||||||
|
|
|
@ -245,7 +245,7 @@
|
||||||
<td style="text-align: right; white-space: nowrap;">
|
<td style="text-align: right; white-space: nowrap;">
|
||||||
<!-- IF items.S_FIRST_ROW and not PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
<!-- IF items.S_FIRST_ROW and not PREVIOUS_PAGE -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
||||||
<!-- IF items.S_LAST_ROW and not NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
<!-- IF items.S_LAST_ROW and not NEXT_PAGE -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{items.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
||||||
<a href="{items.U_EDIT}">{ICON_EDIT}</a> <a href="{items.U_DELETE}">{ICON_DELETE}</a>
|
<a href="{items.U_EDIT}">{ICON_EDIT}</a> <a href="{items.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
|
|
|
@ -152,35 +152,35 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_STATISTIC_RESYNC_OPTIONS}</legend>
|
<legend>{L_STATISTIC_RESYNC_OPTIONS}</legend>
|
||||||
|
|
||||||
<form id="action_online_form" method="post" action="{U_ACTION}">
|
<form id="action_online_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_online">{L_RESET_ONLINE}</label><br /><span> </span></dt>
|
<dt><label for="action_online">{L_RESET_ONLINE}</label><br /><span> </span></dt>
|
||||||
<dd><input type="hidden" name="action" value="online" /><input class="button2" type="submit" id="action_online" name="action_online" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="online" /><input class="button2" type="submit" id="action_online" name="action_online" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="action_date_form" method="post" action="{U_ACTION}">
|
<form id="action_date_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_date">{L_RESET_DATE}</label><br /><span> </span></dt>
|
<dt><label for="action_date">{L_RESET_DATE}</label><br /><span> </span></dt>
|
||||||
<dd><input type="hidden" name="action" value="date" /><input class="button2" type="submit" id="action_date" name="action_date" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="date" /><input class="button2" type="submit" id="action_date" name="action_date" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="action_stats_form" method="post" action="{U_ACTION}">
|
<form id="action_stats_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_stats">{L_RESYNC_STATS}</label><br /><span>{L_RESYNC_STATS_EXPLAIN}</span></dt>
|
<dt><label for="action_stats">{L_RESYNC_STATS}</label><br /><span>{L_RESYNC_STATS_EXPLAIN}</span></dt>
|
||||||
<dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="action_user_form" method="post" action="{U_ACTION}">
|
<form id="action_user_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_user">{L_RESYNC_POSTCOUNTS}</label><br /><span>{L_RESYNC_POSTCOUNTS_EXPLAIN}</span></dt>
|
<dt><label for="action_user">{L_RESYNC_POSTCOUNTS}</label><br /><span>{L_RESYNC_POSTCOUNTS_EXPLAIN}</span></dt>
|
||||||
<dd><input type="hidden" name="action" value="user" /><input class="button2" type="submit" id="action_user" name="action_user" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="user" /><input class="button2" type="submit" id="action_user" name="action_user" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="action_db_track_form" method="post" action="{U_ACTION}">
|
<form id="action_db_track_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_db_track">{L_RESYNC_POST_MARKING}</label><br /><span>{L_RESYNC_POST_MARKING_EXPLAIN}</span></dt>
|
<dt><label for="action_db_track">{L_RESYNC_POST_MARKING}</label><br /><span>{L_RESYNC_POST_MARKING_EXPLAIN}</span></dt>
|
||||||
<dd><input type="hidden" name="action" value="db_track" /><input class="button2" type="submit" id="action_db_track" name="action_db_track" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="db_track" /><input class="button2" type="submit" id="action_db_track" name="action_db_track" value="{L_RUN}" /></dd>
|
||||||
|
@ -188,19 +188,20 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- IF S_FOUNDER -->
|
<!-- IF S_FOUNDER -->
|
||||||
<form id="action_purge_sessions_form" method="post" action="{U_ACTION}">
|
<form id="action_purge_sessions_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_purge_sessions">{L_PURGE_SESSIONS}</label><br /><span>{L_PURGE_SESSIONS_EXPLAIN}</span></dt>
|
<dt><label for="action_purge_sessions">{L_PURGE_SESSIONS}</label><br /><span>{L_PURGE_SESSIONS_EXPLAIN}</span></dt>
|
||||||
<dd><input type="hidden" name="action" value="purge_sessions" /><input class="button2" type="submit" id="action_purge_sessions" name="action_purge_sessions" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="purge_sessions" /><input class="button2" type="submit" id="action_purge_sessions" name="action_purge_sessions" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
<form id="action_purge_cache_form" method="post" action="{U_ACTION}">
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<form id="action_purge_cache_form" method="post" action="{U_ACTION}" data-ajax="true">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="action_purge_cache">{L_PURGE_CACHE}</label><br /><span>{L_PURGE_CACHE_EXPLAIN}</span></dt>
|
<dt><label for="action_purge_cache">{L_PURGE_CACHE}</label><br /><span>{L_PURGE_CACHE_EXPLAIN}</span></dt>
|
||||||
<dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd>
|
<dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
<!-- ENDIF -->
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
{ICON_MOVE_DOWN_DISABLED}
|
{ICON_MOVE_DOWN_DISABLED}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{modules.U_EDIT}">{ICON_EDIT}</a>
|
<a href="{modules.U_EDIT}">{ICON_EDIT}</a>
|
||||||
<a href="{modules.U_DELETE}">{ICON_DELETE}</a>
|
<a href="{modules.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END modules -->
|
<!-- END modules -->
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
{ICON_MOVE_DOWN_DISABLED}
|
{ICON_MOVE_DOWN_DISABLED}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{roles.U_EDIT}" title="{L_EDIT_ROLE}">{ICON_EDIT}</a>
|
<a href="{roles.U_EDIT}" title="{L_EDIT_ROLE}">{ICON_EDIT}</a>
|
||||||
<a href="{roles.U_REMOVE}" title="{L_REMOVE_ROLE}">{ICON_DELETE}</a>
|
<a href="{roles.U_REMOVE}" title="{L_REMOVE_ROLE}" data-ajax="row_delete">{ICON_DELETE}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END roles -->
|
<!-- END roles -->
|
||||||
|
|
|
@ -195,7 +195,7 @@
|
||||||
|
|
||||||
<td>{fields.FIELD_IDENT}</td>
|
<td>{fields.FIELD_IDENT}</td>
|
||||||
<td>{fields.FIELD_TYPE}</td>
|
<td>{fields.FIELD_TYPE}</td>
|
||||||
<td style="text-align: center;"><a href="{fields.U_ACTIVATE_DEACTIVATE}">{fields.L_ACTIVATE_DEACTIVATE}</a><!-- IF fields.S_NEED_EDIT --> | <a href="{fields.U_TRANSLATE}" style="color: red;">{L_TRANSLATE}</a><!-- ENDIF --></td>
|
<td style="text-align: center;"><a href="{fields.U_ACTIVATE_DEACTIVATE}" data-ajax="activate_deactivate">{fields.L_ACTIVATE_DEACTIVATE}</a><!-- IF fields.S_NEED_EDIT --> | <a href="{fields.U_TRANSLATE}" style="color: red;">{L_TRANSLATE}</a><!-- ENDIF --></td>
|
||||||
|
|
||||||
<td style="width: 80px; text-align: right; white-space: nowrap;">
|
<td style="width: 80px; text-align: right; white-space: nowrap;">
|
||||||
<!-- IF fields.S_FIRST_ROW && not fields.S_LAST_ROW -->
|
<!-- IF fields.S_FIRST_ROW && not fields.S_LAST_ROW -->
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
{ICON_EDIT_DISABLED}
|
{ICON_EDIT_DISABLED}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{fields.U_DELETE}">{ICON_DELETE}</a>
|
<a href="{fields.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
<td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE --> - <!-- ENDIF --></td>
|
<td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE --> - <!-- ENDIF --></td>
|
||||||
<td style="text-align: center;">{ranks.RANK_TITLE}</td>
|
<td style="text-align: center;">{ranks.RANK_TITLE}</td>
|
||||||
<td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td>
|
<td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td>
|
||||||
<td style="text-align: center;"><a href="{ranks.U_EDIT}">{ICON_EDIT}</a> <a href="{ranks.U_DELETE}">{ICON_DELETE}</a></td>
|
<td style="text-align: center;"><a href="{ranks.U_EDIT}">{ICON_EDIT}</a> <a href="{ranks.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END ranks -->
|
<!-- END ranks -->
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<a href="{reasons.U_EDIT}">{ICON_EDIT}</a>
|
<a href="{reasons.U_EDIT}">{ICON_EDIT}</a>
|
||||||
<!-- IF reasons.U_DELETE -->
|
<!-- IF reasons.U_DELETE -->
|
||||||
<a href="{reasons.U_DELETE}">{ICON_DELETE}</a>
|
<a href="{reasons.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
{ICON_DELETE_DISABLED}
|
{ICON_DELETE_DISABLED}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -2,377 +2,60 @@
|
||||||
|
|
||||||
<a id="maincontent"></a>
|
<a id="maincontent"></a>
|
||||||
|
|
||||||
<!-- IF S_DELETE -->
|
<!-- IF S_CONFIRM_ACTION -->
|
||||||
|
<form id="confirm" method="post" action="{S_CONFIRM_ACTION}">
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
<fieldset>
|
||||||
|
<h1>{MESSAGE_TITLE}</h1>
|
||||||
|
<p>{MESSAGE_TEXT}</p>
|
||||||
|
<!-- IF S_CONFIRM_DELETE -->
|
||||||
|
<label><input type="checkbox" class="checkbox" name="confirm_delete_files" /> {L_DELETE_FROM_FS}</label>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<h1>{L_TITLE}</h1>
|
{S_HIDDEN_FIELDS}
|
||||||
|
|
||||||
<p>{L_EXPLAIN}</p>
|
<div style="text-align: center;">
|
||||||
|
<input type="submit" name="confirm" value="{L_YES}" class="button2" />
|
||||||
|
<input type="submit" name="cancel" value="{L_NO}" class="button2" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<!-- ELSE -->
|
||||||
|
|
||||||
|
<!-- IF L_TITLE --><h1>{L_TITLE}</h1><!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF L_EXPLAIN --><p>{L_EXPLAIN}</p><!-- ENDIF -->
|
||||||
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
<form id="acp_styles" method="post" action="{U_ACTION}">
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_TITLE}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label>{L_NAME}:</label></dt>
|
|
||||||
<dd><strong>{NAME}</strong></dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="new_id">{L_REPLACE}:</label><br /><span>{L_REPLACE_EXPLAIN}</span></dt>
|
|
||||||
<dd><select id="new_id" name="new_id">{S_REPLACE_OPTIONS}</select></dd>
|
|
||||||
</dl>
|
|
||||||
<!-- IF S_DELETE_STYLE -->
|
|
||||||
<hr />
|
|
||||||
<dl>
|
|
||||||
<dt><label for="new_template_id">{L_DELETE_TEMPLATE}:</label><br /><span>{L_REPLACE_TEMPLATE_EXPLAIN}</span></dt>
|
|
||||||
<dd><select id="new_template_id" name="new_template_id">{S_REPLACE_TEMPLATE_OPTIONS}</select></dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="new_theme_id">{L_DELETE_THEME}:</label><br /><span>{L_REPLACE_THEME_EXPLAIN}</span></dt>
|
|
||||||
<dd><select id="new_theme_id" name="new_theme_id">{S_REPLACE_THEME_OPTIONS}</select></dd>
|
|
||||||
</dl>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<p class="quick">
|
|
||||||
<input class="button1" type="submit" name="update" value="{L_DELETE}" />
|
|
||||||
{S_FORM_TOKEN}
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- ELSEIF S_EDIT_TEMPLATE or S_EDIT_THEME -->
|
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
|
||||||
|
|
||||||
<h1>{L_EDIT}</h1>
|
|
||||||
|
|
||||||
<p>{L_EDIT_EXPLAIN}</p>
|
|
||||||
|
|
||||||
<p>{L_SELECTED}: <strong>{SELECTED_TEMPLATE}</strong></p>
|
|
||||||
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
|
||||||
|
|
||||||
<!-- IF S_EDIT_TEMPLATE or (S_EDIT_THEME and not S_THEME_IN_DB) -->
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_SELECT}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="template_file">{L_FILE}:</label></dt>
|
|
||||||
<dd><select id="template_file" name="template_file" onchange="if (this.options[this.selectedIndex].value != '') this.form.submit();">{S_TEMPLATES}</select> <input class="button2" type="submit" value="{L_SELECT}" /></dd>
|
|
||||||
</dl>
|
|
||||||
{S_FORM_TOKEN}
|
|
||||||
</fieldset>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- IF TEMPLATE_FILE or (S_EDIT_THEME and S_THEME_IN_DB) -->
|
|
||||||
<script type="text/javascript" defer="defer">
|
|
||||||
// <![CDATA[
|
|
||||||
|
|
||||||
function change_editor_height(height)
|
|
||||||
{
|
|
||||||
height = Number(height);
|
|
||||||
|
|
||||||
if (isNaN(height))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor = document.getElementById('template_data');
|
|
||||||
editor.rows = Math.max(5, Math.min(height, 999));
|
|
||||||
|
|
||||||
append_text_rows('acp_styles', height);
|
|
||||||
append_text_rows('acp_template', height);
|
|
||||||
}
|
|
||||||
|
|
||||||
function append_text_rows(form_name, value)
|
|
||||||
{
|
|
||||||
value = Number(value);
|
|
||||||
|
|
||||||
if (isNaN(value))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
url = document.getElementById(form_name).action;
|
|
||||||
|
|
||||||
// Make sure & is actually... &
|
|
||||||
url = url.replace(/&/g, '&');
|
|
||||||
|
|
||||||
var_start = url.indexOf('&text_rows=');
|
|
||||||
if (var_start == -1)
|
|
||||||
{
|
|
||||||
document.getElementById(form_name).action = url + "&text_rows=" + value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
url_start = url.substring(0, var_start + 1);
|
|
||||||
var_end = url.substring(var_start + 1).indexOf('&');
|
|
||||||
if (var_end == -1)
|
|
||||||
{
|
|
||||||
document.getElementById(form_name).action = url_start + "text_rows=" + value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
document.getElementById(form_name).action = url_start + url.substring(var_end + var_start + 2) + "&text_rows=" + value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<form id="acp_template" method="post" action="{U_ACTION}">
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_EDITOR}</legend>
|
|
||||||
<!-- IF S_EDIT_TEMPLATE or (S_EDIT_THEME and not S_THEME_IN_DB) -->
|
|
||||||
<dl>
|
|
||||||
<dt><label>{L_SELECTED_FILE}:</label></dt>
|
|
||||||
<dd>{TEMPLATE_FILE}</dd>
|
|
||||||
</dl>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<dl>
|
|
||||||
<dt><label for="text_rows">{L_EDITOR_HEIGHT}:</label></dt>
|
|
||||||
<dd><input id="text_rows" type="text" maxlength="3" value="{TEXT_ROWS}" /> <input class="button2" type="button" name="update" onclick="change_editor_height(this.form.text_rows.value);" value="{L_UPDATE}" /></dd>
|
|
||||||
</dl>
|
|
||||||
<textarea id="template_data" name="template_data" style="font-family:'Courier New', monospace;font-size:9pt;line-height:125%;width:100%;" cols="80" rows="{TEXT_ROWS}">{TEMPLATE_DATA}</textarea>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="submit-buttons">
|
|
||||||
<legend>{L_SUBMIT}</legend>
|
|
||||||
{S_HIDDEN_FIELDS}
|
{S_HIDDEN_FIELDS}
|
||||||
{S_FORM_TOKEN}
|
{S_FORM_TOKEN}
|
||||||
<input class="button1" id="save" type="submit" name="save" value="{L_SUBMIT}" />
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<!-- ELSEIF S_CACHE -->
|
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
|
||||||
|
|
||||||
<h1>{L_TEMPLATE_CACHE}</h1>
|
|
||||||
|
|
||||||
<p>{L_TEMPLATE_CACHE_EXPLAIN}</p>
|
|
||||||
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
|
||||||
<fieldset class="tabulated">
|
|
||||||
<legend>{L_TEMPLATE_CACHE}</legend>
|
|
||||||
|
|
||||||
<table cellspacing="1">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{L_CACHE_FILENAME}</th>
|
|
||||||
<th>{L_CACHE_FILESIZE}</th>
|
|
||||||
<th>{L_CACHE_CACHED}</th>
|
|
||||||
<th>{L_CACHE_MODIFIED}</th>
|
|
||||||
<th>{L_MARK}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<!-- BEGIN file -->
|
|
||||||
<!-- IF file.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
|
||||||
<td><a href="{file.U_VIEWSOURCE}" onclick="popup(this.href, 750, 550, '_source'); return false;">{file.FILENAME_PATH}</a></td>
|
|
||||||
<td>{file.FILESIZE}</td>
|
|
||||||
<td>{file.CACHED}</td>
|
|
||||||
<td>{file.MODIFIED}</td>
|
|
||||||
<td><input type="checkbox" class="radio" name="delete[]" value="{file.FILENAME}" /></td>
|
|
||||||
</tr>
|
|
||||||
<!-- BEGINELSE -->
|
|
||||||
<tr class="row1">
|
|
||||||
<td colspan="5">{L_TEMPLATE_CACHE_EMPTY}</td>
|
|
||||||
</tr>
|
|
||||||
<!-- END file -->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p class="quick">
|
|
||||||
<span class="small"><a href="#" onclick="marklist('acp_styles', 'delete', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('acp_styles', 'delete', false); return false;">{L_UNMARK_ALL}</a></span><br />
|
|
||||||
{S_FORM_TOKEN}
|
|
||||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_DELETE_MARKED}" />
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- ELSEIF S_EXPORT -->
|
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
|
||||||
|
|
||||||
<h1>{L_TITLE}</h1>
|
|
||||||
|
|
||||||
<p>{L_EXPLAIN}</p>
|
|
||||||
|
|
||||||
<!-- IF S_ERROR_MSG -->
|
|
||||||
<div class="errorbox">
|
|
||||||
<h3>{L_WARNING}</h3>
|
|
||||||
<p>{ERROR_MSG}</p>
|
|
||||||
</div>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
|
||||||
|
|
||||||
|
<!-- IF S_STYLE_DETAILS -->
|
||||||
|
<input type="hidden" name="id" value="{STYLE_ID}" />
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{L_TITLE}</legend>
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label>{L_NAME}:</label></dt>
|
<dt><label for="name">{L_STYLE_NAME}:</label></dt>
|
||||||
<dd><strong>{NAME}</strong></dd>
|
<dd><input type="text" id="name" name="style_name" value="{STYLE_NAME}" /></dd>
|
||||||
</dl>
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
<dl>
|
|
||||||
<dt><label for="inc_template">{L_INCLUDE_TEMPLATE}:</label></dt>
|
|
||||||
<dd><label><input type="radio" class="radio" id="inc_template" name="inc_template" value="1" checked="checked" /> {L_YES}</label>
|
|
||||||
<label><input type="radio" class="radio" name="inc_template" value="0" /> {L_NO}</label></dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="inc_theme">{L_INCLUDE_THEME}:</label></dt>
|
<dt><label>{L_STYLE_PATH}</label></dt>
|
||||||
<dd><label><input type="radio" class="radio" id="inc_theme" name="inc_theme" value="1" checked="checked" /> {L_YES}</label>
|
<dd><strong>{STYLE_PATH}</strong></dd>
|
||||||
<label><input type="radio" class="radio" name="inc_theme" value="0" /> {L_NO}</label></dd>
|
|
||||||
</dl>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<dl>
|
|
||||||
<dt><label for="store">{L_DOWNLOAD_STORE}:</label><br /><span>{L_DOWNLOAD_STORE_EXPLAIN}</span></dt>
|
|
||||||
<dd><label><input type="radio" class="radio" id="store" name="store" value="1" checked="checked" /> {L_EXPORT_STORE}</label>
|
|
||||||
<label><input type="radio" class="radio" name="store" value="0" /> {L_EXPORT_DOWNLOAD}</label></dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="format">{L_ARCHIVE_FORMAT}:</label></dt>
|
<dt><label for="name">{L_COPYRIGHT}:</label></dt>
|
||||||
<dd>{FORMAT_BUTTONS}</dd>
|
<dd><strong>{STYLE_COPYRIGHT}</strong></dd>
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p class="quick">
|
|
||||||
{S_FORM_TOKEN}
|
|
||||||
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- ELSEIF S_FRONTEND -->
|
|
||||||
|
|
||||||
<h1>{L_TITLE}</h1>
|
|
||||||
|
|
||||||
<p>{L_EXPLAIN}</p>
|
|
||||||
|
|
||||||
<!-- IF S_STYLE --> <!-- DEFINE $COLSPAN = 5 --> <!-- ELSE --> <!-- DEFINE $COLSPAN = 4 --> <!-- ENDIF -->
|
|
||||||
|
|
||||||
<table cellspacing="1">
|
|
||||||
<col class="row1" /><!-- IF S_STYLE --><col class="row1" /><!-- ENDIF --><col class="row2" /><col class="row2" />
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{L_NAME}</th>
|
|
||||||
<!-- IF S_STYLE --><th>{L_STYLE_USED_BY}</th><!-- ENDIF -->
|
|
||||||
<th>{L_OPTIONS}</th>
|
|
||||||
<th>{L_ACTIONS}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="{$COLSPAN}"><strong>{L_INSTALLED}</strong></td>
|
|
||||||
</tr>
|
|
||||||
<!-- BEGIN installed -->
|
|
||||||
<!-- IF installed.S_INACTIVE and not $INACTIVE_STYLES -->
|
|
||||||
<!-- DEFINE $INACTIVE_STYLES = 1 -->
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="{$COLSPAN}"><strong>{L_INACTIVE_STYLES}</strong></td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<tr>
|
|
||||||
<td><strong>{installed.NAME}</strong><!-- IF installed.S_DEFAULT_STYLE --> *<!-- ENDIF --></td>
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
<td style="text-align: center;">{installed.STYLE_COUNT}</td>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<td style="text-align: center;">
|
|
||||||
{installed.S_OPTIONS}
|
|
||||||
</td>
|
|
||||||
<td style="text-align: center;">
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
<a href="{installed.U_STYLE_ACT_DEACT}">{installed.L_STYLE_ACT_DEACT}</a> |
|
|
||||||
<!-- ENDIF -->
|
|
||||||
{installed.S_ACTIONS}
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
| <a href="{installed.U_PREVIEW}">{L_PREVIEW}</a>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- END installed -->
|
|
||||||
<tr>
|
|
||||||
<td class="row3" colspan="{$COLSPAN}"><strong>{L_UNINSTALLED}</strong></td>
|
|
||||||
</tr>
|
|
||||||
<!-- IF not .uninstalled -->
|
|
||||||
<tr>
|
|
||||||
<td class="row1" colspan="{$COLSPAN}" style="text-align: center;">{L_NO_UNINSTALLED}</td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- BEGIN uninstalled -->
|
|
||||||
<tr>
|
|
||||||
<td<!-- IF S_STYLE --> colspan="2"<!-- ENDIF -->><strong>{uninstalled.NAME}</strong><br /><span>{L_COPYRIGHT}: {uninstalled.COPYRIGHT}</span></td>
|
|
||||||
<td style="text-align: center;" colspan="2"><a href="{uninstalled.U_INSTALL}">{L_INSTALL}</a></td>
|
|
||||||
</tr>
|
|
||||||
<!-- END uninstalled -->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
|
||||||
|
|
||||||
<fieldset class="quick">
|
|
||||||
<legend>{L_CREATE}</legend>
|
|
||||||
{L_CREATE}: <input type="text" name="name" value="" /> {L_FROM} <select name="basis">{S_BASIS_OPTIONS}</select> <input class="button2" type="submit" name="add" value="{L_SUBMIT}" />
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<!-- ELSEIF S_DETAILS -->
|
|
||||||
|
|
||||||
<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">« {L_BACK}</a>
|
|
||||||
|
|
||||||
<h1>{L_TITLE}</h1>
|
|
||||||
|
|
||||||
<p>{L_EXPLAIN}</p>
|
|
||||||
|
|
||||||
<!-- IF S_ERROR_MSG -->
|
|
||||||
<div class="errorbox">
|
|
||||||
<h3>{L_WARNING}</h3>
|
|
||||||
<p>{ERROR_MSG}</p>
|
|
||||||
</div>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
|
|
||||||
<form id="acp_styles" method="post" action="{U_ACTION}">
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_TITLE}</legend>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="name">{L_NAME}:</label></dt>
|
|
||||||
<dd><!-- IF S_INSTALL --><strong id="name">{NAME}</strong><!-- ELSE --><input type="text" id="name" name="name" value="{NAME}" /><!-- ENDIF --></dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="copyright">{L_COPYRIGHT}:</label></dt>
|
<dt><label for="style_parent">{L_INHERITING_FROM}:</label></dt>
|
||||||
<dd><!-- IF S_INSTALL --><strong id="copyright">{COPYRIGHT}</strong><!-- ELSE --><input type="text" id="copyright" name="copyright" value="{COPYRIGHT}" /><!-- ENDIF --></dd>
|
<dd><select id="style_parent" name="style_parent">
|
||||||
|
<option value=""<!-- IF STYLE_PARENT == 0 --> selected="selected"<!-- ENDIF -->> - </option>
|
||||||
|
<!-- BEGIN parent_styles -->
|
||||||
|
<option value="{parent_styles.STYLE_ID}"<!-- IF parent_styles.STYLE_ID == STYLE_PARENT --> selected="selected"<!-- ENDIF -->>{parent_styles.SPACER}{parent_styles.STYLE_NAME}</option>
|
||||||
|
<!-- END parent_styles -->
|
||||||
|
</select></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- IF S_SUPERTEMPLATE -->
|
|
||||||
<dl>
|
|
||||||
<dt><label for="inheriting">{L_INHERITING_FROM}:</label></dt>
|
|
||||||
<dd><strong id="inheriting">{S_SUPERTEMPLATE}</strong></dd>
|
|
||||||
</dl>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF S_STYLE and not S_BASIS -->
|
|
||||||
<dl>
|
|
||||||
<dt><label for="template_id">{L_STYLE_TEMPLATE}:</label></dt>
|
|
||||||
<dd><!-- IF S_INSTALL --><strong id="template_id">{TEMPLATE_NAME}</strong><!-- ELSE --><select id="template_id" name="template_id">{S_TEMPLATE_OPTIONS}</select><!-- ENDIF --></dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt><label for="theme_id">{L_STYLE_THEME}:</label></dt>
|
|
||||||
<dd><!-- IF S_INSTALL --><strong id="theme_id">{THEME_NAME}</strong><!-- ELSE --><select id="theme_id" name="theme_id">{S_THEME_OPTIONS}</select><!-- ENDIF --></dd>
|
|
||||||
</dl>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF S_STYLE -->
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>{L_OPTIONS}</legend>
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="style_active">{L_STYLE_ACTIVE}:</label></dt>
|
<dt><label for="style_active">{L_STYLE_ACTIVE}:</label></dt>
|
||||||
<dd><label><input type="radio" class="radio" name="style_active" value="1"<!-- IF S_STYLE_ACTIVE --> id="style_active" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
<dd><label><input type="radio" class="radio" name="style_active" value="1"<!-- IF S_STYLE_ACTIVE --> id="style_active" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||||
|
@ -385,14 +68,99 @@
|
||||||
<label><input type="radio" class="radio" id="style_default" name="style_default" value="0" checked="checked" /> {L_NO}</label></dd>
|
<label><input type="radio" class="radio" id="style_default" name="style_default" value="0" checked="checked" /> {L_NO}</label></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="submit-buttons">
|
<fieldset class="submit-buttons">
|
||||||
<legend>{L_SUBMIT}</legend>
|
<legend>{L_SUBMIT}</legend>
|
||||||
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
||||||
|
<a href="{U_ACTION}" class="button2">{L_BACK}</a>
|
||||||
{S_FORM_TOKEN}
|
{S_FORM_TOKEN}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF .styles_list -->
|
||||||
|
<table cellspacing="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{L_STYLE_NAME}</th>
|
||||||
|
<!-- IF not STYLES_LIST_HIDE_COUNT --><th width="10%" style="white-space: nowrap; text-align: center;">{L_STYLE_USED_BY}</th><!-- ENDIF -->
|
||||||
|
<th width="25%" style="white-space: nowrap; text-align: center;">{L_ACTIONS}</th>
|
||||||
|
{STYLES_LIST_EXTRA}
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<!-- BEGIN styles_list -->
|
||||||
|
<tbody id="styles-list-{styles_list.S_ROW_COUNT}">
|
||||||
|
<tr<!-- IF styles_list.STYLE_ID and not styles_list.STYLE_ACTIVE --> class="row-inactive"<!-- ENDIF -->>
|
||||||
|
<!-- IF styles_list.LEVEL is odd -->
|
||||||
|
<!-- IF $ROW_CLASS == 'row1a' --><!-- DEFINE $ROW_CLASS = 'row1b' --><!-- ELSE --><!-- DEFINE $ROW_CLASS = 'row1a' --><!-- ENDIF -->
|
||||||
|
<!-- ELSE -->
|
||||||
|
<!-- IF $ROW_CLASS == 'row2a' --><!-- DEFINE $ROW_CLASS = 'row2b' --><!-- ELSE --><!-- DEFINE $ROW_CLASS = 'row2a' --><!-- ENDIF -->
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<td class="{$ROW_CLASS}" style="padding-left: {styles_list.PADDING}px;">
|
||||||
|
<!-- IF styles_list.STYLE_ID and styles_list.COMMENT == '' and styles_list.STYLE_ACTIVE -->
|
||||||
|
<div class="default-style" style="display: none; float: right;">
|
||||||
|
<input class="radio" type="radio" name="default" value="{styles_list.STYLE_ID}"<!-- IF styles_list.DEFAULT --> checked="checked"<!-- ELSE --><!-- DEFINE $S_DEFAULT = 1 --><!-- ENDIF --> title="{L_STYLE_DEFAULT}" />
|
||||||
|
</div>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF styles_list.DEFAULT or styles_list.SHOW_COPYRIGHT -->
|
||||||
|
<strong>{styles_list.STYLE_NAME}</strong>
|
||||||
|
<!-- IF styles_list.SHOW_COPYRIGHT and styles_list.COMMENT == '' --><span><br />{styles_list.STYLE_COPYRIGHT}</span><!-- ENDIF -->
|
||||||
|
<!-- ELSE -->
|
||||||
|
<span>{styles_list.STYLE_NAME}</span>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF styles_list.COMMENT != '' -->
|
||||||
|
<span class="error"><br />{styles_list.COMMENT}</span>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF not styles_list.STYLE_ID and styles_list.COMMENT == '' -->
|
||||||
|
<span class="style-path"><br />{L_STYLE_PATH} {styles_list.STYLE_PATH_FULL}</span>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</td>
|
||||||
|
<!-- IF not STYLES_LIST_HIDE_COUNT -->
|
||||||
|
<td class="{$ROW_CLASS}" style="text-align: center;">{styles_list.USERS}</td>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<td class="{$ROW_CLASS}" style="text-align: center;">
|
||||||
|
<!-- BEGIN actions -->
|
||||||
|
<!-- IF styles_list.actions.S_ROW_COUNT > 0 --> | <!-- ENDIF -->
|
||||||
|
<!-- IF styles_list.actions.U_ACTION -->
|
||||||
|
<a href="{styles_list.actions.U_ACTION}"{styles_list.actions.U_ACTION_ATTR}>{styles_list.actions.L_ACTION}</a>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
{styles_list.actions.HTML}
|
||||||
|
<!-- END actions -->
|
||||||
|
</td>
|
||||||
|
{styles_list.EXTRA}
|
||||||
|
<td class="{$ROW_CLASS}" width="20" style="text-align: center;">
|
||||||
|
<!-- IF styles_list.STYLE_ID -->
|
||||||
|
<input class="checkbox" type="checkbox" name="ids[]" value="{styles_list.STYLE_ID}" />
|
||||||
|
<!-- ELSE -->
|
||||||
|
<!-- IF styles_list.COMMENT != '' -->
|
||||||
|
|
||||||
|
<!-- ELSE -->
|
||||||
|
<input class="checkbox" type="checkbox" name="dirs[]" value="{styles_list.STYLE_PATH}" />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<!-- END styles_list -->
|
||||||
|
</table>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF .extra_actions -->
|
||||||
|
<fieldset class="quick">
|
||||||
|
<!-- BEGIN extra_actions -->
|
||||||
|
<input type="submit" name="{extra_actions.ACTION_NAME}" class="button2" value="{extra_actions.L_ACTION}" />
|
||||||
|
<!-- END extra_actions -->
|
||||||
|
</fieldset>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF .extra_links -->
|
||||||
|
<fieldset class="quick">
|
||||||
|
<!-- BEGIN extra_links -->
|
||||||
|
<a class="button2" href="{extra_links.U_ACTION}">{extra_links.L_ACTION}</a>
|
||||||
|
<!-- END extra_links -->
|
||||||
|
</fieldset>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<!-- IF words.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
<!-- IF words.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||||
<td style="text-align: center;">{words.WORD}</td>
|
<td style="text-align: center;">{words.WORD}</td>
|
||||||
<td style="text-align: center;">{words.REPLACEMENT}</td>
|
<td style="text-align: center;">{words.REPLACEMENT}</td>
|
||||||
<td> <a href="{words.U_EDIT}">{ICON_EDIT}</a> <a href="{words.U_DELETE}">{ICON_DELETE}</a> </td>
|
<td> <a href="{words.U_EDIT}">{ICON_EDIT}</a> <a href="{words.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGINELSE -->
|
<!-- BEGINELSE -->
|
||||||
<tr class="row3">
|
<tr class="row3">
|
||||||
|
|
|
@ -101,6 +101,10 @@ hr {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* General links */
|
/* General links */
|
||||||
a:link, a:visited {
|
a:link, a:visited {
|
||||||
color: #105289;
|
color: #105289;
|
||||||
|
@ -626,12 +630,29 @@ td.name {
|
||||||
.col1 { background-color: #DCEBFE; }
|
.col1 { background-color: #DCEBFE; }
|
||||||
.col2 { background-color: #F9F9F9; }
|
.col2 { background-color: #F9F9F9; }
|
||||||
|
|
||||||
|
/* 4 row background colours for trees */
|
||||||
|
.row1a { background-color: #F9F9F9; }
|
||||||
|
.row1b { background-color: #F6F6F6; }
|
||||||
|
.row2a { background-color: #E7EEF4; }
|
||||||
|
.row2b { background-color: #E3EBF2; }
|
||||||
|
|
||||||
.spacer {
|
.spacer {
|
||||||
background-color: #DBDFE2;
|
background-color: #DBDFE2;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
line-height: 1px;
|
line-height: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deactivated row */
|
||||||
|
.row-inactive {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.row-inactive a, .row-inactive strong {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
.row-inactive a:hover {
|
||||||
|
color: #BC2A4D;
|
||||||
|
}
|
||||||
|
|
||||||
/* General form styles
|
/* General form styles
|
||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
fieldset {
|
fieldset {
|
||||||
|
@ -1070,6 +1091,56 @@ input.disabled {
|
||||||
color: #666666;
|
color: #666666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* jQuery popups
|
||||||
|
---------------------------------------- */
|
||||||
|
.phpbb_alert {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px solid #999999;
|
||||||
|
position: fixed;
|
||||||
|
display: none;
|
||||||
|
top: 100px;
|
||||||
|
left: 35%;
|
||||||
|
width: 30%;
|
||||||
|
z-index: 50;
|
||||||
|
padding: 25px;
|
||||||
|
padding: 0 25px 20px 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phpbb_alert .alert_close {
|
||||||
|
display: block;
|
||||||
|
float: right;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-decoration: none !important;
|
||||||
|
background: transparent url("../images/alert_close.png") 0 0 no-repeat;
|
||||||
|
margin-top: -7px;
|
||||||
|
margin-right: -31px;
|
||||||
|
}
|
||||||
|
.phpbb_alert .alert_close:hover {
|
||||||
|
background-position: 0 -16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.phpbb_alert p {
|
||||||
|
margin: 8px 0;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#darkenwrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#darken {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
/* Pagination
|
/* Pagination
|
||||||
---------------------------------------- */
|
---------------------------------------- */
|
||||||
.pagination {
|
.pagination {
|
||||||
|
|
135
phpBB/adm/style/ajax.js
Normal file
135
phpBB/adm/style/ajax.js
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
(function($) { // Avoid conflicts with other libraries
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var img_templates = {
|
||||||
|
up: $('.template-up-img'),
|
||||||
|
up_disabled: $('.template-up-img-disabled'),
|
||||||
|
down: $('.template-down-img'),
|
||||||
|
down_disabled: $('.template-down-img-disabled')
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following callbacks are for reording forums in acp_forums. forum_down
|
||||||
|
* is triggered when a forum is moved down, and forum_up is triggered when
|
||||||
|
* a forum is moved up. It moves the row up or down, and deactivates /
|
||||||
|
* activates any up / down icons that require it (the ones at the top or bottom).
|
||||||
|
*/
|
||||||
|
phpbb.add_ajax_callback('forum_down', function() {
|
||||||
|
var el = $(this),
|
||||||
|
tr = el.parents('tr');
|
||||||
|
|
||||||
|
if (tr.is(':first-child'))
|
||||||
|
{
|
||||||
|
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
|
||||||
|
el.parents('span').siblings('.up').html(up_img);
|
||||||
|
|
||||||
|
tr.next().find('.up').html(img_templates.up_disabled);
|
||||||
|
|
||||||
|
phpbb.ajaxify({
|
||||||
|
selector: el.parents('span').siblings('.up').children('a'),
|
||||||
|
callback: 'forum_up'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.insertAfter(tr.next());
|
||||||
|
|
||||||
|
if (tr.is(':last-child'))
|
||||||
|
{
|
||||||
|
el.replaceWith(img_templates.down_disabled);
|
||||||
|
|
||||||
|
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
|
||||||
|
tr.prev().find('.down').html(down_img);
|
||||||
|
|
||||||
|
phpbb.ajaxify({
|
||||||
|
selector: tr.prev().find('.down').children('a'),
|
||||||
|
callback: 'forum_down'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
phpbb.add_ajax_callback('forum_up', function() {
|
||||||
|
var el = $(this),
|
||||||
|
tr = el.parents('tr');
|
||||||
|
|
||||||
|
if (tr.is(':last-child'))
|
||||||
|
{
|
||||||
|
var down_img = img_templates.down.clone().attr('href', tr.attr('data-down'));
|
||||||
|
el.parents('span').siblings('.down').html(down_img);
|
||||||
|
|
||||||
|
tr.prev().find('.down').html(img_templates.down_disabled);
|
||||||
|
|
||||||
|
phpbb.ajaxify({
|
||||||
|
selector: el.parents('span').siblings('.down').children('a'),
|
||||||
|
callback: 'forum_down'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.insertBefore(tr.prev());
|
||||||
|
|
||||||
|
if (tr.is(':first-child'))
|
||||||
|
{
|
||||||
|
el.replaceWith(img_templates.up_disabled);
|
||||||
|
|
||||||
|
var up_img = img_templates.up.clone().attr('href', tr.attr('data-up'));
|
||||||
|
tr.next().find('.up').html(up_img);
|
||||||
|
|
||||||
|
phpbb.ajaxify({
|
||||||
|
selector: tr.next().find('.up').children('a'),
|
||||||
|
callback: 'forum_up'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This callback replaces activate links with deactivate links and vice versa.
|
||||||
|
* It does this by replacing the text, and replacing all instances of "activate"
|
||||||
|
* in the href with "deactivate", and vice versa.
|
||||||
|
*/
|
||||||
|
phpbb.add_ajax_callback('activate_deactivate', function(res) {
|
||||||
|
var el = $(this),
|
||||||
|
new_href = el.attr('href');
|
||||||
|
|
||||||
|
el.text(res.text);
|
||||||
|
|
||||||
|
if (new_href.indexOf('deactivate') !== -1)
|
||||||
|
{
|
||||||
|
new_href = new_href.replace('deactivate', 'activate')
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_href = new_href.replace('activate', 'deactivate')
|
||||||
|
}
|
||||||
|
|
||||||
|
el.attr('href', new_href);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The removes the parent row of the link or form that triggered the callback,
|
||||||
|
* and is good for stuff like the removal of forums.
|
||||||
|
*/
|
||||||
|
phpbb.add_ajax_callback('row_delete', function() {
|
||||||
|
$(this).parents('tr').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('[data-ajax]').each(function() {
|
||||||
|
var $this = $(this),
|
||||||
|
ajax = $this.attr('data-ajax'),
|
||||||
|
fn;
|
||||||
|
|
||||||
|
if (ajax !== 'false')
|
||||||
|
{
|
||||||
|
fn = (ajax !== 'true') ? ajax : null;
|
||||||
|
phpbb.ajaxify({
|
||||||
|
selector: this,
|
||||||
|
refresh: $this.attr('data-refresh') !== undefined,
|
||||||
|
callback: fn
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})(jQuery); // Avoid conflicts with other libraries
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<div id="page-footer">
|
<div id="page-footer">
|
||||||
<!-- IF S_COPYRIGHT_HTML -->
|
<!-- IF S_COPYRIGHT_HTML -->
|
||||||
Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group
|
{CREDIT_LINE}
|
||||||
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
|
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
@ -17,11 +17,30 @@
|
||||||
<!-- IF S_COPYRIGHT_HTML --><br /><!-- ENDIF -->
|
<!-- IF S_COPYRIGHT_HTML --><br /><!-- ENDIF -->
|
||||||
{DEBUG_OUTPUT}
|
{DEBUG_OUTPUT}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
||||||
|
<div id="darken"> </div>
|
||||||
|
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}">
|
||||||
|
<a href="#" class="alert_close"></a>
|
||||||
|
<h3 class="alert_title"></h3><p class="alert_text"></p>
|
||||||
|
</div>
|
||||||
|
<div id="phpbb_confirm" class="phpbb_alert">
|
||||||
|
<a href="#" class="alert_close"></a>
|
||||||
|
<p class="alert_text"></p>
|
||||||
|
<input type="button" class="button1" value="{L_YES}" />
|
||||||
|
<input type="button" class="button2" value="{L_NO}" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
|
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
|
||||||
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
|
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
|
||||||
|
<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js"></script>
|
||||||
|
<!-- INCLUDEJS ajax.js -->
|
||||||
|
{SCRIPTS}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div id="page-footer">
|
<div id="page-footer">
|
||||||
|
|
||||||
<!-- IF S_COPYRIGHT_HTML -->
|
<!-- IF S_COPYRIGHT_HTML -->
|
||||||
<br />Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group
|
<br />{CREDIT_LINE}
|
||||||
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
|
<!-- IF TRANSLATION_INFO --><br />{TRANSLATION_INFO}<!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
|
445
phpBB/assets/javascript/core.js
Normal file
445
phpBB/assets/javascript/core.js
Normal file
|
@ -0,0 +1,445 @@
|
||||||
|
var phpbb = {};
|
||||||
|
phpbb.alert_time = 100;
|
||||||
|
|
||||||
|
(function($) { // Avoid conflicts with other libraries
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// define a couple constants for keydown functions.
|
||||||
|
var keymap = {
|
||||||
|
ENTER: 13,
|
||||||
|
ESC: 27
|
||||||
|
};
|
||||||
|
|
||||||
|
var dark = $('#darkenwrapper');
|
||||||
|
var loading_alert = $('#loadingalert');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a loading screen.
|
||||||
|
*
|
||||||
|
* @returns object Returns loading_alert.
|
||||||
|
*/
|
||||||
|
phpbb.loading_alert = function() {
|
||||||
|
if (dark.is(':visible'))
|
||||||
|
{
|
||||||
|
loading_alert.fadeIn(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loading_alert.show();
|
||||||
|
dark.fadeIn(phpbb.alert_time, function() {
|
||||||
|
// Wait five seconds and display an error if nothing has been returned by then.
|
||||||
|
setTimeout(function() {
|
||||||
|
if (loading_alert.is(':visible'))
|
||||||
|
{
|
||||||
|
phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return loading_alert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a simple alert similar to JSs native alert().
|
||||||
|
*
|
||||||
|
* You can only call one alert or confirm box at any one time.
|
||||||
|
*
|
||||||
|
* @param string title Title of the message, eg "Information" (HTML).
|
||||||
|
* @param string msg Message to display (HTML).
|
||||||
|
* @param bool fadedark Remove the dark background when done? Defaults
|
||||||
|
* to yes.
|
||||||
|
*
|
||||||
|
* @returns object Returns the div created.
|
||||||
|
*/
|
||||||
|
phpbb.alert = function(title, msg, fadedark) {
|
||||||
|
var div = $('#phpbb_alert');
|
||||||
|
div.find('.alert_title').html(title);
|
||||||
|
div.find('.alert_text').html(msg);
|
||||||
|
|
||||||
|
div.bind('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
dark.one('click', function(e) {
|
||||||
|
var fade;
|
||||||
|
|
||||||
|
div.find('.alert_close').unbind('click');
|
||||||
|
fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark;
|
||||||
|
fade.fadeOut(phpbb.alert_time, function() {
|
||||||
|
div.hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).bind('keydown', function(e) {
|
||||||
|
if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
|
||||||
|
dark.trigger('click');
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
div.find('.alert_close').one('click', function(e) {
|
||||||
|
dark.trigger('click');
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (loading_alert.is(':visible'))
|
||||||
|
{
|
||||||
|
loading_alert.fadeOut(phpbb.alert_time, function() {
|
||||||
|
dark.append(div);
|
||||||
|
div.fadeIn(phpbb.alert_time);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (dark.is(':visible'))
|
||||||
|
{
|
||||||
|
dark.append(div);
|
||||||
|
div.fadeIn(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dark.append(div);
|
||||||
|
div.show();
|
||||||
|
dark.fadeIn(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a simple yes / no box to the user.
|
||||||
|
*
|
||||||
|
* You can only call one alert or confirm box at any one time.
|
||||||
|
*
|
||||||
|
* @param string msg Message to display (HTML).
|
||||||
|
* @param function callback Callback. Bool param, whether the user pressed
|
||||||
|
* yes or no (or whatever their language is).
|
||||||
|
* @param bool fadedark Remove the dark background when done? Defaults
|
||||||
|
* to yes.
|
||||||
|
*
|
||||||
|
* @returns object Returns the div created.
|
||||||
|
*/
|
||||||
|
phpbb.confirm = function(msg, callback, fadedark) {
|
||||||
|
var div = $('#phpbb_confirm');
|
||||||
|
div.find('.alert_text').html(msg);
|
||||||
|
|
||||||
|
div.bind('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
var click_handler = function(e) {
|
||||||
|
var res = this.className === 'button1';
|
||||||
|
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
|
||||||
|
fade.fadeOut(phpbb.alert_time, function() {
|
||||||
|
div.hide();
|
||||||
|
});
|
||||||
|
div.find('input[type="button"]').unbind('click', click_handler);
|
||||||
|
callback(res);
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
div.find('input[type="button"]').one('click', click_handler);
|
||||||
|
|
||||||
|
dark.one('click', function(e) {
|
||||||
|
div.find('.alert_close').unbind('click');
|
||||||
|
dark.fadeOut(phpbb.alert_time, function() {
|
||||||
|
div.hide();
|
||||||
|
});
|
||||||
|
callback(false);
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).bind('keydown', function(e) {
|
||||||
|
if (e.keyCode === keymap.ENTER) {
|
||||||
|
$('input[type="button"].button1').trigger('click');
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
} else if (e.keyCode === keymap.ESC) {
|
||||||
|
$('input[type="button"].button2').trigger('click');
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
div.find('.alert_close').one('click', function(e) {
|
||||||
|
var fade = (typeof fadedark !== 'undefined' && fadedark) ? div : dark;
|
||||||
|
fade.fadeOut(phpbb.alert_time, function() {
|
||||||
|
div.hide();
|
||||||
|
});
|
||||||
|
callback(false);
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (loading_alert.is(':visible'))
|
||||||
|
{
|
||||||
|
loading_alert.fadeOut(phpbb.alert_time, function() {
|
||||||
|
dark.append(div);
|
||||||
|
div.fadeIn(phpbb.alert_time);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (dark.is(':visible'))
|
||||||
|
{
|
||||||
|
dark.append(div);
|
||||||
|
div.fadeIn(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dark.append(div);
|
||||||
|
div.show();
|
||||||
|
dark.fadeIn(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn a querystring into an array.
|
||||||
|
*
|
||||||
|
* @argument string string The querystring to parse.
|
||||||
|
* @returns object The object created.
|
||||||
|
*/
|
||||||
|
phpbb.parse_querystring = function(string) {
|
||||||
|
var params = {}, i, split;
|
||||||
|
|
||||||
|
string = string.split('&');
|
||||||
|
for (i = 0; i < string.length; i++)
|
||||||
|
{
|
||||||
|
split = string[i].split('=');
|
||||||
|
params[split[0]] = decodeURIComponent(split[1]);
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a link use AJAX instead of loading an entire page.
|
||||||
|
*
|
||||||
|
* This function will work for links (both standard links and links which
|
||||||
|
* invoke confirm_box) and forms. It will be called automatically for links
|
||||||
|
* and forms with the data-ajax attribute set, and will call the necessary
|
||||||
|
* callback.
|
||||||
|
*
|
||||||
|
* For more info, view the following page on the phpBB wiki:
|
||||||
|
* http://wiki.phpbb.com/JavaScript_Function.phpbb.ajaxify
|
||||||
|
*
|
||||||
|
* @param object options Options.
|
||||||
|
* @param bool/function refresh If we are sent back a refresh, should it be
|
||||||
|
* acted upon? This can either be true / false / a function.
|
||||||
|
* @param function callback Callback to call on completion of event. Has
|
||||||
|
* three parameters: the element that the event was evoked from, the JSON
|
||||||
|
* that was returned and (if it is a form) the form action.
|
||||||
|
*/
|
||||||
|
phpbb.ajaxify = function(options) {
|
||||||
|
var elements = $(options.selector),
|
||||||
|
refresh = options.refresh,
|
||||||
|
callback = options.callback,
|
||||||
|
is_form = elements.is('form'),
|
||||||
|
event_name = is_form ? 'submit' : 'click';
|
||||||
|
|
||||||
|
elements.bind(event_name, function(event) {
|
||||||
|
var action, method, data, submit, that = this, $this = $(this);
|
||||||
|
|
||||||
|
if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false')
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a private function used to handle the callbacks, refreshes
|
||||||
|
* and alert. It calls the callback, refreshes the page if necessary, and
|
||||||
|
* displays an alert to the user and removes it after an amount of time.
|
||||||
|
*
|
||||||
|
* It cannot be called from outside this function, and is purely here to
|
||||||
|
* avoid repetition of code.
|
||||||
|
*
|
||||||
|
* @param object res The object sent back by the server.
|
||||||
|
*/
|
||||||
|
function return_handler(res)
|
||||||
|
{
|
||||||
|
var alert;
|
||||||
|
|
||||||
|
// Is a confirmation required?
|
||||||
|
if (typeof res.S_CONFIRM_ACTION === 'undefined')
|
||||||
|
{
|
||||||
|
// If a confirmation is not required, display an alert and call the
|
||||||
|
// callbacks.
|
||||||
|
if (typeof res.MESSAGE_TITLE !== 'undefined')
|
||||||
|
{
|
||||||
|
alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dark.fadeOut(phpbb.alert_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof phpbb.ajax_callbacks[callback] === 'function')
|
||||||
|
{
|
||||||
|
phpbb.ajax_callbacks[callback].call(that, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the server says to refresh the page, check whether the page should
|
||||||
|
// be refreshed and refresh page after specified time if required.
|
||||||
|
if (res.REFRESH_DATA)
|
||||||
|
{
|
||||||
|
if (typeof refresh === 'function')
|
||||||
|
{
|
||||||
|
refresh = refresh(res.REFRESH_DATA.url);
|
||||||
|
}
|
||||||
|
else if (typeof refresh !== 'boolean')
|
||||||
|
{
|
||||||
|
refresh = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (refresh)
|
||||||
|
{
|
||||||
|
window.location = res.REFRESH_DATA.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide the alert even if we refresh the page, in case the user
|
||||||
|
// presses the back button.
|
||||||
|
dark.fadeOut(phpbb.alert_time, function() {
|
||||||
|
alert.hide();
|
||||||
|
});
|
||||||
|
}, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If confirmation is required, display a diologue to the user.
|
||||||
|
phpbb.confirm(res.MESSAGE_TEXT, function(del) {
|
||||||
|
if (del)
|
||||||
|
{
|
||||||
|
phpbb.loading_alert();
|
||||||
|
data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize();
|
||||||
|
$.ajax({
|
||||||
|
url: res.S_CONFIRM_ACTION,
|
||||||
|
type: 'POST',
|
||||||
|
data: data + '&confirm=' + res.YES_VALUE,
|
||||||
|
success: return_handler,
|
||||||
|
error: error_handler
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function error_handler()
|
||||||
|
{
|
||||||
|
var alert;
|
||||||
|
|
||||||
|
alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
dark.fadeOut(phpbb.alert_time, function() {
|
||||||
|
alert.hide();
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the element is a form, POST must be used and some extra data must
|
||||||
|
// be taken from the form.
|
||||||
|
var run_filter = (typeof options.filter === 'function');
|
||||||
|
|
||||||
|
if (is_form)
|
||||||
|
{
|
||||||
|
action = $this.attr('action').replace('&', '&');
|
||||||
|
data = $this.serializeArray();
|
||||||
|
method = $this.attr('method') || 'GET';
|
||||||
|
|
||||||
|
if ($this.find('input[type="submit"][data-clicked]'))
|
||||||
|
{
|
||||||
|
submit = $this.find('input[type="submit"][data-clicked]');
|
||||||
|
data.push({
|
||||||
|
name: submit.attr('name'),
|
||||||
|
value: submit.val()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
action = this.href;
|
||||||
|
data = null;
|
||||||
|
method = 'GET';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If filter function returns false, cancel the AJAX functionality,
|
||||||
|
// and return true (meaning that the HTTP request will be sent normally).
|
||||||
|
if (run_filter && !options.filter.call(this, data))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
phpbb.loading_alert();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: action,
|
||||||
|
type: method,
|
||||||
|
data: data,
|
||||||
|
success: return_handler,
|
||||||
|
error: error_handler
|
||||||
|
});
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (is_form) {
|
||||||
|
elements.find('input:submit').click(function () {
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
$this.siblings('[data-clicked]').removeAttr('data-clicked');
|
||||||
|
$this.attr('data-clicked', 'true');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
phpbb.ajax_callbacks = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an AJAX callback to be used by phpbb.ajaxify.
|
||||||
|
*
|
||||||
|
* See the phpbb.ajaxify comments for information on stuff like parameters.
|
||||||
|
*
|
||||||
|
* @param string id The name of the callback.
|
||||||
|
* @param function callback The callback to be called.
|
||||||
|
*/
|
||||||
|
phpbb.add_ajax_callback = function(id, callback)
|
||||||
|
{
|
||||||
|
if (typeof callback === 'function')
|
||||||
|
{
|
||||||
|
phpbb.ajax_callbacks[id] = callback;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This callback alternates text - it replaces the current text with the text in
|
||||||
|
* the alt-text data attribute, and replaces the text in the attribute with the
|
||||||
|
* current text so that the process can be repeated.
|
||||||
|
*/
|
||||||
|
phpbb.add_ajax_callback('alt_text', function(data) {
|
||||||
|
var el = $(this),
|
||||||
|
alt_text;
|
||||||
|
|
||||||
|
alt_text = el.attr('data-alt-text');
|
||||||
|
el.attr('title', alt_text);
|
||||||
|
el.text(alt_text);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
})(jQuery); // Avoid conflicts with other libraries
|
|
@ -5,7 +5,7 @@
|
||||||
* @copyright (c) 2005 phpBB Group
|
* @copyright (c) 2005 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
* Minimum Requirement: PHP 5.2.0
|
* Minimum Requirement: PHP 5.3.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +15,8 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
require($phpbb_root_path . 'includes/startup.' . $phpEx);
|
require($phpbb_root_path . 'includes/startup.' . $phpEx);
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
|
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
|
||||||
|
@ -72,8 +74,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/session.' . $phpEx);
|
|
||||||
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
|
||||||
|
|
||||||
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
|
||||||
|
@ -98,9 +98,10 @@ $phpbb_class_loader_ext->set_cache($cache->get_driver());
|
||||||
$phpbb_class_loader->set_cache($cache->get_driver());
|
$phpbb_class_loader->set_cache($cache->get_driver());
|
||||||
|
|
||||||
// Instantiate some basic classes
|
// Instantiate some basic classes
|
||||||
|
$phpbb_dispatcher = new phpbb_event_dispatcher();
|
||||||
$request = new phpbb_request();
|
$request = new phpbb_request();
|
||||||
$user = new user();
|
$user = new phpbb_user();
|
||||||
$auth = new auth();
|
$auth = new phpbb_auth();
|
||||||
$db = new $sql_db();
|
$db = new $sql_db();
|
||||||
|
|
||||||
// make sure request_var uses this request instance
|
// make sure request_var uses this request instance
|
||||||
|
@ -120,9 +121,14 @@ set_config_count(null, null, null, $config);
|
||||||
// load extensions
|
// load extensions
|
||||||
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
|
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
|
||||||
|
|
||||||
$phpbb_template_locator = new phpbb_template_locator();
|
// Initialize style
|
||||||
$phpbb_template_path_provider = new phpbb_template_extension_path_provider($phpbb_extension_manager, new phpbb_template_path_provider());
|
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_template_locator, $phpbb_template_path_provider);
|
$phpbb_style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
|
||||||
|
$template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider);
|
||||||
|
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
|
||||||
|
|
||||||
|
$phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager);
|
||||||
|
$phpbb_subscriber_loader->load();
|
||||||
|
|
||||||
// Add own hook handler
|
// Add own hook handler
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||||
|
|
5
phpBB/composer.json
Normal file
5
phpBB/composer.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"symfony/event-dispatcher": "2.0.*"
|
||||||
|
}
|
||||||
|
}
|
10
phpBB/composer.lock
generated
Normal file
10
phpBB/composer.lock
generated
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"hash": "9bada3748ec2933fe0864dcfafbcd671",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"package": "symfony/event-dispatcher",
|
||||||
|
"version": "v2.0.10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aliases": []
|
||||||
|
}
|
|
@ -1528,6 +1528,7 @@ function get_schema_struct()
|
||||||
'report_closed' => array('BOOL', 0),
|
'report_closed' => array('BOOL', 0),
|
||||||
'report_time' => array('TIMESTAMP', 0),
|
'report_time' => array('TIMESTAMP', 0),
|
||||||
'report_text' => array('MTEXT_UNI', ''),
|
'report_text' => array('MTEXT_UNI', ''),
|
||||||
|
'reported_post_text' => array('MTEXT_UNI', ''),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'report_id',
|
'PRIMARY_KEY' => 'report_id',
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
|
@ -1654,43 +1655,14 @@ function get_schema_struct()
|
||||||
'style_name' => array('VCHAR_UNI:255', ''),
|
'style_name' => array('VCHAR_UNI:255', ''),
|
||||||
'style_copyright' => array('VCHAR_UNI', ''),
|
'style_copyright' => array('VCHAR_UNI', ''),
|
||||||
'style_active' => array('BOOL', 1),
|
'style_active' => array('BOOL', 1),
|
||||||
'template_id' => array('UINT', 0),
|
'style_path' => array('VCHAR:100', ''),
|
||||||
'theme_id' => array('UINT', 0),
|
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
||||||
|
'style_parent_id' => array('UINT:4', 0),
|
||||||
|
'style_parent_tree' => array('TEXT', ''),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'style_id',
|
'PRIMARY_KEY' => 'style_id',
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
'style_name' => array('UNIQUE', 'style_name'),
|
'style_name' => array('UNIQUE', 'style_name'),
|
||||||
'template_id' => array('INDEX', 'template_id'),
|
|
||||||
'theme_id' => array('INDEX', 'theme_id'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$schema_data['phpbb_styles_template'] = array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'template_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'template_name' => array('VCHAR_UNI:255', ''),
|
|
||||||
'template_copyright' => array('VCHAR_UNI', ''),
|
|
||||||
'template_path' => array('VCHAR:100', ''),
|
|
||||||
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
|
||||||
'template_inherits_id' => array('UINT:4', 0),
|
|
||||||
'template_inherit_path' => array('VCHAR', ''),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'template_id',
|
|
||||||
'KEYS' => array(
|
|
||||||
'tmplte_nm' => array('UNIQUE', 'template_name'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$schema_data['phpbb_styles_theme'] = array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'theme_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'theme_name' => array('VCHAR_UNI:255', ''),
|
|
||||||
'theme_copyright' => array('VCHAR_UNI', ''),
|
|
||||||
'theme_path' => array('VCHAR:100', ''),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'theme_id',
|
|
||||||
'KEYS' => array(
|
|
||||||
'theme_name' => array('UNIQUE', 'theme_name'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ $search_errors = array();
|
||||||
$search = new $class_name($search_errors);
|
$search = new $class_name($search_errors);
|
||||||
|
|
||||||
$batch_size = isset($argv[2]) ? $argv[2] : 2000;
|
$batch_size = isset($argv[2]) ? $argv[2] : 2000;
|
||||||
$time = time();
|
|
||||||
|
|
||||||
if (method_exists($search, 'create_index'))
|
if (method_exists($search, 'create_index'))
|
||||||
{
|
{
|
||||||
|
@ -67,6 +66,7 @@ else
|
||||||
while ($post_counter <= $max_post_id)
|
while ($post_counter <= $max_post_id)
|
||||||
{
|
{
|
||||||
$row_count = 0;
|
$row_count = 0;
|
||||||
|
$time = time();
|
||||||
|
|
||||||
printf("Processing posts with %d <= post_id <= %d\n",
|
printf("Processing posts with %d <= post_id <= %d\n",
|
||||||
$post_counter + 1,
|
$post_counter + 1,
|
||||||
|
|
|
@ -37,6 +37,13 @@ function list_extensions()
|
||||||
global $phpbb_extension_manager;
|
global $phpbb_extension_manager;
|
||||||
|
|
||||||
$phpbb_extension_manager->load_extensions();
|
$phpbb_extension_manager->load_extensions();
|
||||||
|
$all = array_keys($phpbb_extension_manager->all_available());
|
||||||
|
|
||||||
|
if (empty($all))
|
||||||
|
{
|
||||||
|
echo "There were no extensions found.\n";
|
||||||
|
exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
echo "Enabled:\n";
|
echo "Enabled:\n";
|
||||||
$enabled = array_keys($phpbb_extension_manager->all_enabled());
|
$enabled = array_keys($phpbb_extension_manager->all_enabled());
|
||||||
|
@ -49,7 +56,6 @@ function list_extensions()
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
echo "Available:\n";
|
echo "Available:\n";
|
||||||
$all = array_keys($phpbb_extension_manager->all_available());
|
|
||||||
$purged = array_diff($all, $enabled, $disabled);
|
$purged = array_diff($all, $enabled, $disabled);
|
||||||
print_extensions($purged);
|
print_extensions($purged);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1091,61 +1091,14 @@ function get_schema_struct()
|
||||||
'style_name' => array('VCHAR_UNI:255', ''),
|
'style_name' => array('VCHAR_UNI:255', ''),
|
||||||
'style_copyright' => array('VCHAR_UNI', ''),
|
'style_copyright' => array('VCHAR_UNI', ''),
|
||||||
'style_active' => array('BOOL', 1),
|
'style_active' => array('BOOL', 1),
|
||||||
'template_id' => array('UINT', 0),
|
'style_path' => array('VCHAR:100', ''),
|
||||||
'theme_id' => array('UINT', 0),
|
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
||||||
|
'style_parent_id' => array('UINT:4', 0),
|
||||||
|
'style_parent_tree' => array('TEXT', ''),
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'style_id',
|
'PRIMARY_KEY' => 'style_id',
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
'style_name' => array('UNIQUE', 'style_name'),
|
'style_name' => array('UNIQUE', 'style_name'),
|
||||||
'template_id' => array('INDEX', 'template_id'),
|
|
||||||
'theme_id' => array('INDEX', 'theme_id'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$schema_data['phpbb_styles_template'] = array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'template_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'template_name' => array('VCHAR_UNI:255', ''),
|
|
||||||
'template_copyright' => array('VCHAR_UNI', ''),
|
|
||||||
'template_path' => array('VCHAR:100', ''),
|
|
||||||
'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
|
|
||||||
'template_storedb' => array('BOOL', 0),
|
|
||||||
'template_inherits_id' => array('UINT:4', 0),
|
|
||||||
'template_inherit_path' => array('VCHAR', ''),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'template_id',
|
|
||||||
'KEYS' => array(
|
|
||||||
'tmplte_nm' => array('UNIQUE', 'template_name'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$schema_data['phpbb_styles_template_data'] = array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'template_id' => array('UINT', 0),
|
|
||||||
'template_filename' => array('VCHAR:100', ''),
|
|
||||||
'template_included' => array('TEXT', ''),
|
|
||||||
'template_mtime' => array('TIMESTAMP', 0),
|
|
||||||
'template_data' => array('MTEXT_UNI', ''),
|
|
||||||
),
|
|
||||||
'KEYS' => array(
|
|
||||||
'tid' => array('INDEX', 'template_id'),
|
|
||||||
'tfn' => array('INDEX', 'template_filename'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$schema_data['phpbb_styles_theme'] = array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'theme_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'theme_name' => array('VCHAR_UNI:255', ''),
|
|
||||||
'theme_copyright' => array('VCHAR_UNI', ''),
|
|
||||||
'theme_path' => array('VCHAR:100', ''),
|
|
||||||
'theme_storedb' => array('BOOL', 0),
|
|
||||||
'theme_mtime' => array('TIMESTAMP', 0),
|
|
||||||
'theme_data' => array('MTEXT_UNI', ''),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'theme_id',
|
|
||||||
'KEYS' => array(
|
|
||||||
'theme_name' => array('UNIQUE', 'theme_name'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -79,3 +79,6 @@ Pear (c) 2001-2004 PHP Group, http://pear.php.net
|
||||||
|
|
||||||
Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff
|
Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff
|
||||||
|
|
||||||
|
MIT licenced:
|
||||||
|
Symfony2 (c) 2004-2011 Fabien Potencier, http://symfony.com/
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
<li>Oracle</li>
|
<li>Oracle</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>PHP 5.2.0+</strong> with support for the database you intend to use.</li>
|
<li><strong>PHP 5.3.2+</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>
|
||||||
|
|
|
@ -306,11 +306,11 @@
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<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>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.3.2.</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 5.2.0 to 5.3.x 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.3.2 to 5.4.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>
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<p>To use any methods contained with the <code>auth</code> class it first needs to be instantiated. This is best achieved early in the execution of the script in the following manner:</p>
|
<p>To use any methods contained with the <code>auth</code> class it first needs to be instantiated. This is best achieved early in the execution of the script in the following manner:</p>
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
$auth = new auth();
|
$auth = new phpbb_auth();
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>Once an instance of the class has been created you are free to call the various methods it contains. Please note that should you wish to use the <code>auth_admin</code> methods you will need to instantiate this separately but in the same way.</p>
|
<p>Once an instance of the class has been created you are free to call the various methods it contains. Please note that should you wish to use the <code>auth_admin</code> methods you will need to instantiate this separately but in the same way.</p>
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<li><a href="#templating">Templating</a>
|
<li><a href="#templating">Templating</a>
|
||||||
<ol style="list-style-type: lower-roman;">
|
<ol style="list-style-type: lower-roman;">
|
||||||
<li><a href="#templates">General Templating</a></li>
|
<li><a href="#templates">General Templating</a></li>
|
||||||
<li><a href="#inheritance">Template Inheritance</a></li>
|
<li><a href="#stylestree">Styles Tree</a></li>
|
||||||
</ol></li>
|
</ol></li>
|
||||||
<li><a href="#charsets">Character Sets and Encodings</a></li>
|
<li><a href="#charsets">Character Sets and Encodings</a></li>
|
||||||
<li><a href="#translation">Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</a>
|
<li><a href="#translation">Translation (<abbr title="Internationalisation">i18n</abbr>/<abbr title="Localisation">L10n</abbr>) Guidelines</a>
|
||||||
|
@ -248,7 +248,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
|
||||||
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
|
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>/includes/session.php - user::img()</li>
|
<li>/includes/user.php - phpbb_user::img()</li>
|
||||||
<li>/includes/functions_content.php - smiley_text()</li>
|
<li>/includes/functions_content.php - smiley_text()</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -1144,15 +1144,19 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a name="cfgfiles"></a><h3>3.i. Style Config Files</h3>
|
<a name="cfgfiles"></a><h3>3.i. Style Config Files</h3>
|
||||||
<p>Style cfg files are simple name-value lists with the information necessary for installing a style. Similar cfg files exist for templates, themes and imagesets. These follow the same principle and will not be introduced individually. Styles can use installed components by using the required_theme/required_template/required_imageset entries. The important part of the style configuration file is assigning an unique name.</p>
|
<p>Style cfg files are simple name-value lists with the information necessary for installing a style. The important part of the style configuration file is assigning an unique name.</p>
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
# General Information about this style
|
# General Information about this style
|
||||||
name = prosilver_duplicate
|
name = prosilver_duplicate
|
||||||
copyright = © phpBB Group, 2007
|
copyright = © phpBB Group, 2007
|
||||||
version = 3.0.3
|
version = 3.1.0
|
||||||
required_template = prosilver
|
|
||||||
required_theme = prosilver
|
# Defining a different template bitfield
|
||||||
required_imageset = prosilver
|
# template_bitfield = lNg=
|
||||||
|
|
||||||
|
# Parent style
|
||||||
|
# Set value to empty or to this style's name if this style does not have a parent style
|
||||||
|
parent = prosilver
|
||||||
</pre></div>
|
</pre></div>
|
||||||
<a name="genstyling"></a><h3>3.2. General Styling Rules</h3>
|
<a name="genstyling"></a><h3>3.2. General Styling Rules</h3>
|
||||||
<p>Templates should be produced in a consistent manner. Where appropriate they should be based off an existing copy, e.g. index, viewforum or viewtopic (the combination of which implement a range of conditional and variable forms). Please also note that the indentation and coding guidelines also apply to templates where possible.</p>
|
<p>Templates should be produced in a consistent manner. Where appropriate they should be based off an existing copy, e.g. index, viewforum or viewtopic (the combination of which implement a range of conditional and variable forms). Please also note that the indentation and coding guidelines also apply to templates where possible.</p>
|
||||||
|
@ -1175,7 +1179,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
|
||||||
|
|
||||||
<p>Row colours/classes are now defined by the template, use an <code>IF S_ROW_COUNT</code> switch, see viewtopic or viewforum for an example.</p>
|
<p>Row colours/classes are now defined by the template, use an <code>IF S_ROW_COUNT</code> switch, see viewtopic or viewforum for an example.</p>
|
||||||
|
|
||||||
<p>Remember block level ordering is important ... while not all pages validate as XHTML 1.0 Strict compliant it is something we're trying to work on.</p>
|
<p>Remember block level ordering is important.</p>
|
||||||
|
|
||||||
<p>Use a standard cellpadding of 2 and cellspacing of 0 on outer tables. Inner tables can vary from 0 to 3 or even 4 depending on the need.</p>
|
<p>Use a standard cellpadding of 2 and cellspacing of 0 on outer tables. Inner tables can vary from 0 to 3 or even 4 depending on the need.</p>
|
||||||
|
|
||||||
|
@ -1243,13 +1247,13 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
|
||||||
<p>A bit later loops will be explained further. To not irritate you we will explain conditionals as well as other statements first.</p>
|
<p>A bit later loops will be explained further. To not irritate you we will explain conditionals as well as other statements first.</p>
|
||||||
|
|
||||||
<h4>Including files</h4>
|
<h4>Including files</h4>
|
||||||
<p>Something that existed in 2.0.x which no longer exists in 3.0.x is the ability to assign a template to a variable. This was used (for example) to output the jumpbox. Instead (perhaps better, perhaps not but certainly more flexible) we now have INCLUDE. This takes the simple form:</p>
|
<p>Something that existed in 2.0.x which no longer exists in 3.x is the ability to assign a template to a variable. This was used (for example) to output the jumpbox. Instead (perhaps better, perhaps not but certainly more flexible) we now have INCLUDE. This takes the simple form:</p>
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
<span class="comment"><!-- INCLUDE filename --></span>
|
<span class="comment"><!-- INCLUDE filename --></span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>You will note in the 3.0 templates the major sources start with <code><!-- INCLUDE overall_header.html --></code> or <code><!-- INCLUDE simple_header.html --></code>, etc. In 2.0.x control of "which" header to use was defined entirely within the code. In 3.0.x the template designer can output what they like. Note that you can introduce new templates (i.e. other than those in the default set) using this system and include them as you wish ... perhaps useful for a common "menu" bar or some such. No need to modify loads of files as with 2.0.x.</p>
|
<p>You will note in the 3.x templates the major sources start with <code><!-- INCLUDE overall_header.html --></code> or <code><!-- INCLUDE simple_header.html --></code>, etc. In 2.0.x control of "which" header to use was defined entirely within the code. In 3.x the template designer can output what they like. Note that you can introduce new templates (i.e. other than those in the default set) using this system and include them as you wish ... perhaps useful for a common "menu" bar or some such. No need to modify loads of files as with 2.0.x.</p>
|
||||||
|
|
||||||
<p>Added in <strong>3.0.6</strong> is the ability to include a file using a template variable to specify the file, this functionality only works for root variables (i.e. not block variables).</p>
|
<p>Added in <strong>3.0.6</strong> is the ability to include a file using a template variable to specify the file, this functionality only works for root variables (i.e. not block variables).</p>
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
|
@ -1281,7 +1285,7 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;
|
||||||
<p>it will be included and executed inline.<br /><br />A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence <!-- w --><a href="http://www.phpbb.com">www.phpbb.com</a><!-- w --> will <strong>not</strong> make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).</p>
|
<p>it will be included and executed inline.<br /><br />A note, it is very much encouraged that template designers do not include PHP. The ability to include raw PHP was introduced primarily to allow end users to include banner code, etc. without modifying multiple files (as with 2.0.x). It was not intended for general use ... hence <!-- w --><a href="http://www.phpbb.com">www.phpbb.com</a><!-- w --> will <strong>not</strong> make available template sets which include PHP. And by default templates will have PHP disabled (the admin will need to specifically activate PHP for a template).</p>
|
||||||
|
|
||||||
<h4>Conditionals/Control structures</h4>
|
<h4>Conditionals/Control structures</h4>
|
||||||
<p>The most significant addition to 3.0.x are conditions or control structures, "if something then do this else do that". The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:</p>
|
<p>The most significant addition to 3.x are conditions or control structures, "if something then do this else do that". The system deployed is very similar to Smarty. This may confuse some people at first but it offers great potential and great flexibility with a little imagination. In their most simple form these constructs take the form:</p>
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
<span class="comment"><!-- IF expr --></span>
|
<span class="comment"><!-- IF expr --></span>
|
||||||
|
@ -1352,7 +1356,7 @@ div
|
||||||
<span class="comment"><!-- ENDIF --></span>
|
<span class="comment"><!-- ENDIF --></span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>Each statement will be tested in turn and the relevant output generated when a match (if a match) is found. It is not necessary to always use ELSEIF, ELSE can be used alone to match "everything else".<br /><br />So what can you do with all this? Well take for example the colouration of rows in viewforum. In 2.0.x row colours were predefined within the source as either row color1, row color2 or row class1, row class2. In 3.0.x this is moved to the template, it may look a little daunting at first but remember control flows from top to bottom and it's not too difficult:</p>
|
<p>Each statement will be tested in turn and the relevant output generated when a match (if a match) is found. It is not necessary to always use ELSEIF, ELSE can be used alone to match "everything else".<br /><br />So what can you do with all this? Well take for example the colouration of rows in viewforum. In 2.0.x row colours were predefined within the source as either row color1, row color2 or row class1, row class2. In 3.x this is moved to the template, it may look a little daunting at first but remember control flows from top to bottom and it's not too difficult:</p>
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
<table>
|
<table>
|
||||||
|
@ -1623,24 +1627,25 @@ div
|
||||||
</form>
|
</form>
|
||||||
</pre></div><br />
|
</pre></div><br />
|
||||||
|
|
||||||
<a name="inheritance"></a><h3>4.ii. Template Inheritance</h3>
|
<a name="stylestree"></a><h3>4.ii. Styles Tree</h3>
|
||||||
<p>When basing a new style on an existing one, it is not necessary to provide all the template files. By declaring the base style name in the <strong>inherit_from</strong> field in the template configuration file, the style can be set to inherit template files from the base style. The limitation on this is that the base style has to be installed and complete, meaning that it is not itself inheriting.</p>
|
<p>When basing a new style on an existing one, it is not necessary to provide all the template files. By declaring the base style name in the <strong>parent</strong> field in the style configuration file, the style can be set to reuse template files from the parent style.</p>
|
||||||
|
|
||||||
<p>The effect of doing so is that the template engine will use the template files in the new style where they exist, but fall back to files in the base style otherwise. Declaring a style to inherit from another also causes it to use some of the configuration settings of the base style, notably database storage.</p>
|
<p>The effect of doing so is that the template engine will use the template files in the new style where they exist, but fall back to files in the parent style otherwise.</p>
|
||||||
|
|
||||||
<p>We strongly encourage the use of inheritance for styles based on the bundled styles, as it will ease the update procedure.</p>
|
<p>We strongly encourage the use of parent styles for styles based on the bundled styles, as it will ease the update procedure.</p>
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
# General Information about this template
|
# General Information about this style
|
||||||
name = inherits
|
name = Custom Style
|
||||||
copyright = © phpBB Group, 2007
|
copyright = &copy; phpBB Group, 2007
|
||||||
version = 3.0.3
|
version = 3.1.0
|
||||||
|
|
||||||
# Defining a different template bitfield
|
# Defining a different template bitfield
|
||||||
template_bitfield = lNg=
|
# template_bitfield = lNg=
|
||||||
|
|
||||||
# Are we inheriting?
|
# Parent style
|
||||||
inherit_from = prosilver
|
# Set value to empty or to this style's name if this style does not have a parent style
|
||||||
|
parent = prosilver
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -2347,7 +2352,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
|
||||||
|
|
||||||
<div class="codebox"><pre>
|
<div class="codebox"><pre>
|
||||||
...
|
...
|
||||||
'FOO_BAR' => 'PHP version < 5.2.0.<br />
|
'FOO_BAR' => 'PHP version < 5.3.2.<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>
|
||||||
|
@ -2356,7 +2361,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; 5.2.0.<br />
|
'FOO_BAR' => 'PHP version &lt; 5.3.2.<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>
|
||||||
|
@ -2365,7 +2370,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; 5.2.0.<br />
|
'FOO_BAR' => 'PHP version &lt; 5.3.2.<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>
|
||||||
|
|
|
@ -368,7 +368,7 @@ a:active { color: #368AD2; }
|
||||||
|
|
||||||
<p>In phpBB3 there are four functions you are able to hook into with your custom functions:</p>
|
<p>In phpBB3 there are four functions you are able to hook into with your custom functions:</p>
|
||||||
|
|
||||||
<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 phpbb_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, $template);</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>
|
||||||
|
@ -388,7 +388,7 @@ PHPBB_USE_BOARD_URL_PATH (use generate_board_url() for image paths instead of $p
|
||||||
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
|
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>/includes/session.php - user::img()</li>
|
<li>/includes/user.php - phpbb_user::img()</li>
|
||||||
<li>/includes/functions_content.php - smiley_text()</li>
|
<li>/includes/functions_content.php - smiley_text()</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ if (isset($_GET['avatar']))
|
||||||
$phpbb_class_loader_ext->set_cache($cache->get_driver());
|
$phpbb_class_loader_ext->set_cache($cache->get_driver());
|
||||||
$phpbb_class_loader->set_cache($cache->get_driver());
|
$phpbb_class_loader->set_cache($cache->get_driver());
|
||||||
|
|
||||||
|
$phpbb_dispatcher = new phpbb_event_dispatcher();
|
||||||
$request = new phpbb_request();
|
$request = new phpbb_request();
|
||||||
$db = new $sql_db();
|
$db = new $sql_db();
|
||||||
|
|
||||||
|
@ -78,6 +79,9 @@ if (isset($_GET['avatar']))
|
||||||
// load extensions
|
// load extensions
|
||||||
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
|
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
|
||||||
|
|
||||||
|
$phpbb_subscriber_loader = new phpbb_event_extension_subscriber_loader($phpbb_dispatcher, $phpbb_extension_manager);
|
||||||
|
$phpbb_subscriber_loader->load();
|
||||||
|
|
||||||
$filename = request_var('avatar', '');
|
$filename = request_var('avatar', '');
|
||||||
$avatar_group = false;
|
$avatar_group = false;
|
||||||
$exit = false;
|
$exit = false;
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_bbcodes
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $request;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
@ -272,6 +272,18 @@ class acp_bbcodes
|
||||||
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
||||||
$cache->destroy('sql', BBCODES_TABLE);
|
$cache->destroy('sql', BBCODES_TABLE);
|
||||||
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'],
|
||||||
|
'REFRESH_DATA' => array(
|
||||||
|
'time' => 3
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_bots
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template, $cache, $request;
|
||||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
||||||
|
|
||||||
$action = request_var('action', '');
|
$action = request_var('action', '');
|
||||||
|
@ -353,6 +353,14 @@ class acp_bots
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate'))
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$s_options = '';
|
$s_options = '';
|
||||||
$_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');
|
$_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');
|
||||||
foreach ($_options as $value => $lang)
|
foreach ($_options as $value => $lang)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_forums
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $request;
|
||||||
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$user->add_lang('acp/forums');
|
$user->add_lang('acp/forums');
|
||||||
|
@ -256,6 +256,12 @@ class acp_forums
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
$cache->destroy('sql', FORUMS_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array('success' => ($move_forum_name !== false)));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sync':
|
case 'sync':
|
||||||
|
|
|
@ -782,6 +782,18 @@ class acp_icons
|
||||||
|
|
||||||
$cache->destroy('_icons');
|
$cache->destroy('_icons');
|
||||||
$cache->destroy('sql', $table);
|
$cache->destroy('sql', $table);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $notice,
|
||||||
|
'REFRESH_DATA' => array(
|
||||||
|
'time' => 3
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_main
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template;
|
global $config, $db, $user, $auth, $template, $request;
|
||||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
// Show restore permissions notice
|
// Show restore permissions notice
|
||||||
|
@ -129,6 +129,11 @@ class acp_main
|
||||||
set_config('record_online_users', 1, true);
|
set_config('record_online_users', 1, true);
|
||||||
set_config('record_online_date', time(), true);
|
set_config('record_online_date', time(), true);
|
||||||
add_log('admin', 'LOG_RESET_ONLINE');
|
add_log('admin', 'LOG_RESET_ONLINE');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('RESET_ONLINE_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'stats':
|
case 'stats':
|
||||||
|
@ -179,6 +184,11 @@ class acp_main
|
||||||
update_last_username();
|
update_last_username();
|
||||||
|
|
||||||
add_log('admin', 'LOG_RESYNC_STATS');
|
add_log('admin', 'LOG_RESYNC_STATS');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('RESYNC_STATS_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user':
|
case 'user':
|
||||||
|
@ -242,6 +252,10 @@ class acp_main
|
||||||
|
|
||||||
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('RESYNC_POSTCOUNTS_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'date':
|
case 'date':
|
||||||
|
@ -252,6 +266,11 @@ class acp_main
|
||||||
|
|
||||||
set_config('board_startdate', time() - 1);
|
set_config('board_startdate', time() - 1);
|
||||||
add_log('admin', 'LOG_RESET_DATE');
|
add_log('admin', 'LOG_RESET_DATE');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('RESET_DATE_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'db_track':
|
case 'db_track':
|
||||||
|
@ -327,14 +346,14 @@ class acp_main
|
||||||
}
|
}
|
||||||
|
|
||||||
add_log('admin', 'LOG_RESYNC_POST_MARKING');
|
add_log('admin', 'LOG_RESYNC_POST_MARKING');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('RESYNC_POST_MARKING_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge_cache':
|
case 'purge_cache':
|
||||||
if ((int) $user->data['user_type'] !== USER_FOUNDER)
|
|
||||||
{
|
|
||||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
global $cache;
|
global $cache;
|
||||||
$cache->purge();
|
$cache->purge();
|
||||||
|
|
||||||
|
@ -343,6 +362,11 @@ class acp_main
|
||||||
cache_moderators();
|
cache_moderators();
|
||||||
|
|
||||||
add_log('admin', 'LOG_PURGE_CACHE');
|
add_log('admin', 'LOG_PURGE_CACHE');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('PURGE_CACHE_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge_sessions':
|
case 'purge_sessions':
|
||||||
|
@ -389,6 +413,11 @@ class acp_main
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
add_log('admin', 'LOG_PURGE_SESSIONS');
|
add_log('admin', 'LOG_PURGE_SESSIONS');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
trigger_error('PURGE_SESSIONS_SUCCESS');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,11 +426,11 @@ class acp_main
|
||||||
// Version check
|
// Version check
|
||||||
$user->add_lang('install');
|
$user->add_lang('install');
|
||||||
|
|
||||||
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.2.0', '<'))
|
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.2', '<'))
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_PHP_VERSION_OLD' => true,
|
'S_PHP_VERSION_OLD' => true,
|
||||||
'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&t=1958605">', '</a>'),
|
'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&t=2152375">', '</a>'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class acp_modules
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $module;
|
global $db, $user, $auth, $template, $module, $request;
|
||||||
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
|
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
|
||||||
|
@ -373,6 +373,15 @@ class acp_modules
|
||||||
// Default management page
|
// Default management page
|
||||||
if (sizeof($errors))
|
if (sizeof($errors))
|
||||||
{
|
{
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang('ERROR'),
|
||||||
|
'MESSAGE_TEXT' => implode('<br />', $errors),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_ERROR' => true,
|
'S_ERROR' => true,
|
||||||
'ERROR_MSG' => implode('<br />', $errors))
|
'ERROR_MSG' => implode('<br />', $errors))
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ class acp_permissions
|
||||||
{
|
{
|
||||||
if ($user_id != $user->data['user_id'])
|
if ($user_id != $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$auth2 = new auth();
|
$auth2 = new phpbb_auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
$auth_setting = $auth2->acl_get($permission);
|
$auth_setting = $auth2->acl_get($permission);
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,15 @@ class acp_profile
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident);
|
add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response();
|
||||||
|
$json_response->send(array(
|
||||||
|
'text' => $user->lang('DEACTIVATE'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -266,7 +275,16 @@ class acp_profile
|
||||||
$field_ident = (string) $db->sql_fetchfield('field_ident');
|
$field_ident = (string) $db->sql_fetchfield('field_ident');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response();
|
||||||
|
$json_response->send(array(
|
||||||
|
'text' => $user->lang('ACTIVATE'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident);
|
add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident);
|
||||||
|
|
||||||
trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_ranks
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $request;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
@ -122,6 +122,18 @@ class acp_ranks
|
||||||
$cache->destroy('_ranks');
|
$cache->destroy('_ranks');
|
||||||
|
|
||||||
add_log('admin', 'LOG_RANK_REMOVED', $rank_title);
|
add_log('admin', 'LOG_RANK_REMOVED', $rank_title);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'],
|
||||||
|
'REFRESH_DATA' => array(
|
||||||
|
'time' => 3
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -128,7 +128,7 @@ class acp_users
|
||||||
$dropdown_modes = array();
|
$dropdown_modes = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (!$this->p_master->module_auth($row['module_auth']))
|
if (!$this->p_master->module_auth_self($row['module_auth']))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1555,7 +1555,7 @@ class acp_users
|
||||||
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
|
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
|
||||||
{
|
{
|
||||||
// We also need to check if the user has the permission to cloak.
|
// We also need to check if the user has the permission to cloak.
|
||||||
$user_auth = new auth();
|
$user_auth = new phpbb_auth();
|
||||||
$user_auth->acl($user_row);
|
$user_auth->acl($user_row);
|
||||||
|
|
||||||
$session_sql_ary = array(
|
$session_sql_ary = array(
|
||||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACP Permission/Auth class
|
* ACP Permission/Auth class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class auth_admin extends auth
|
class auth_admin extends phpbb_auth
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Init auth settings
|
* Init auth settings
|
||||||
|
@ -130,7 +130,7 @@ class auth_admin extends auth
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] != $userdata['user_id'])
|
if ($user->data['user_id'] != $userdata['user_id'])
|
||||||
{
|
{
|
||||||
$auth2 = new auth();
|
$auth2 = new phpbb_auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -17,11 +17,11 @@ class acp_styles_info
|
||||||
return array(
|
return array(
|
||||||
'filename' => 'acp_styles',
|
'filename' => 'acp_styles',
|
||||||
'title' => 'ACP_CAT_STYLES',
|
'title' => 'ACP_CAT_STYLES',
|
||||||
'version' => '1.0.0',
|
'version' => '2.0.0',
|
||||||
'modes' => array(
|
'modes' => array(
|
||||||
'style' => array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')),
|
'style' => array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')),
|
||||||
'template' => array('title' => 'ACP_TEMPLATES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_COMPONENTS')),
|
'install' => array('title' => 'ACP_STYLES_INSTALL', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')),
|
||||||
'theme' => array('title' => 'ACP_THEMES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_COMPONENTS')),
|
'cache' => array('title' => 'ACP_STYLES_CACHE', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Permission/Auth class
|
* Permission/Auth class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class auth
|
class phpbb_auth
|
||||||
{
|
{
|
||||||
var $acl = array();
|
var $acl = array();
|
||||||
var $cache = array();
|
var $cache = array();
|
|
@ -132,12 +132,13 @@ class bbcode
|
||||||
{
|
{
|
||||||
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
|
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
|
||||||
|
|
||||||
$template_locator = new phpbb_template_locator();
|
$style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$template_path_provider = new phpbb_template_extension_path_provider($phpbb_extension_manager, new phpbb_template_path_provider());
|
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
|
||||||
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator, $template_path_provider);
|
$template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider);
|
||||||
$template->set_template();
|
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
|
||||||
$template_locator->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
$style->set_style();
|
||||||
$this->template_filename = $template_locator->get_source_file_for_handle('bbcode.html');
|
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
||||||
|
$this->template_filename = $style_resource_locator->get_source_file_for_handle('bbcode.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
$bbcode_ids = $rowset = $sql = array();
|
$bbcode_ids = $rowset = $sql = array();
|
||||||
|
|
|
@ -25,7 +25,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)
|
public static function get_instance($name)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
$instance = new phpbb_captcha_gd();
|
$instance = new phpbb_captcha_gd();
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
return new phpbb_captcha_gd_wave();
|
return new phpbb_captcha_gd_wave();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class phpbb_captcha_nogd extends phpbb_default_captcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
$instance = new phpbb_captcha_nogd();
|
$instance = new phpbb_captcha_nogd();
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
|
@ -98,7 +98,7 @@ class phpbb_captcha_qa
|
||||||
/**
|
/**
|
||||||
* API function
|
* API function
|
||||||
*/
|
*/
|
||||||
function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
$instance = new phpbb_captcha_qa();
|
$instance = new phpbb_captcha_qa();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class phpbb_recaptcha extends phpbb_default_captcha
|
||||||
$this->response = request_var('recaptcha_response_field', '');
|
$this->response = request_var('recaptcha_response_field', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_instance()
|
public static function get_instance()
|
||||||
{
|
{
|
||||||
$instance = new phpbb_recaptcha();
|
$instance = new phpbb_recaptcha();
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
68
phpBB/includes/event/data.php
Normal file
68
phpBB/includes/event/data.php
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
|
|
||||||
|
class phpbb_event_data extends Event implements ArrayAccess
|
||||||
|
{
|
||||||
|
private $data;
|
||||||
|
|
||||||
|
public function __construct(array $data = array())
|
||||||
|
{
|
||||||
|
$this->set_data($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_data(array $data = array())
|
||||||
|
{
|
||||||
|
$this->data = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_data()
|
||||||
|
{
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns data filtered to only include specified keys.
|
||||||
|
*
|
||||||
|
* This effectively discards any keys added to data by hooks.
|
||||||
|
*/
|
||||||
|
public function get_data_filtered($keys)
|
||||||
|
{
|
||||||
|
return array_intersect_key($this->data, array_flip($keys));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return isset($this->data[$offset]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
return isset($this->data[$offset]) ? $this->data[$offset] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
$this->data[$offset] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
unset($this->data[$offset]);
|
||||||
|
}
|
||||||
|
}
|
42
phpBB/includes/event/dispatcher.php
Normal file
42
phpBB/includes/event/dispatcher.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of the Symfony2 EventDispatcher
|
||||||
|
*
|
||||||
|
* It provides an additional `trigger_event` method, which
|
||||||
|
* gives some syntactic sugar for dispatching events. Instead
|
||||||
|
* of creating the event object, the method will do that for
|
||||||
|
* you.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* $vars = array('page_title');
|
||||||
|
* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class phpbb_event_dispatcher extends EventDispatcher
|
||||||
|
{
|
||||||
|
public function trigger_event($eventName, $data = array())
|
||||||
|
{
|
||||||
|
$event = new phpbb_event_data($data);
|
||||||
|
$this->dispatch($eventName, $event);
|
||||||
|
return $event->get_data_filtered(array_keys($data));
|
||||||
|
}
|
||||||
|
}
|
46
phpBB/includes/event/extension_subscriber_loader.php
Normal file
46
phpBB/includes/event/extension_subscriber_loader.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
|
class phpbb_event_extension_subscriber_loader
|
||||||
|
{
|
||||||
|
private $dispatcher;
|
||||||
|
private $extension_manager;
|
||||||
|
|
||||||
|
public function __construct(EventDispatcherInterface $dispatcher, phpbb_extension_manager $extension_manager)
|
||||||
|
{
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
|
$this->extension_manager = $extension_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
|
$finder = $this->extension_manager->get_finder();
|
||||||
|
$subscriber_classes = $finder
|
||||||
|
->extension_directory('/event')
|
||||||
|
->suffix('listener')
|
||||||
|
->core_path('event/')
|
||||||
|
->get_classes();
|
||||||
|
|
||||||
|
foreach ($subscriber_classes as $class)
|
||||||
|
{
|
||||||
|
$subscriber = new $class();
|
||||||
|
$this->dispatcher->addSubscriber($subscriber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
phpBB/includes/extension/controller.php
Normal file
77
phpBB/includes/extension/controller.php
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package extension
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class extended by extension front controller classes
|
||||||
|
*
|
||||||
|
* @package extension
|
||||||
|
*/
|
||||||
|
abstract class phpbb_extension_controller implements phpbb_extension_controller_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var phpbb_request Request class object
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var dbal DBAL class object
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var user User class object
|
||||||
|
*/
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var phpbb_template Template class object
|
||||||
|
*/
|
||||||
|
protected $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Config array
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string PHP Extension
|
||||||
|
*/
|
||||||
|
protected $phpEx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Relative path to board root
|
||||||
|
*/
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor method that provides the common phpBB objects as inherited class
|
||||||
|
* properties for automatic availability in extension controllers
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
global $request, $db, $user, $template, $config;
|
||||||
|
global $phpEx, $phpbb_root_path;
|
||||||
|
|
||||||
|
$this->request = $request;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->template = $template;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->phpEx = $phpEx;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
}
|
||||||
|
}
|
31
phpBB/includes/extension/controller_interface.php
Normal file
31
phpBB/includes/extension/controller_interface.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package extension
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface that extension classes have to implement to run front pages
|
||||||
|
*
|
||||||
|
* @package extension
|
||||||
|
*/
|
||||||
|
interface phpbb_extension_controller_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the request to display a page from an extension
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function handle();
|
||||||
|
}
|
|
@ -270,11 +270,12 @@ class phpbb_extension_finder
|
||||||
* Finds all directories matching the configured options
|
* Finds all directories matching the configured options
|
||||||
*
|
*
|
||||||
* @param bool $cache Whether the result should be cached
|
* @param bool $cache Whether the result should be cached
|
||||||
|
* @param bool $extension_keys Whether the result should have extension name as array key
|
||||||
* @return array An array of paths to found directories
|
* @return array An array of paths to found directories
|
||||||
*/
|
*/
|
||||||
public function get_directories($cache = true)
|
public function get_directories($cache = true, $extension_keys = false)
|
||||||
{
|
{
|
||||||
return $this->find_with_root_path($cache, true);
|
return $this->find_with_root_path($cache, true, $extension_keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,17 +295,26 @@ class phpbb_extension_finder
|
||||||
* @param bool $cache Whether the result should be cached
|
* @param bool $cache Whether the result should be cached
|
||||||
* @param bool $is_dir Directories will be returned when true, only files
|
* @param bool $is_dir Directories will be returned when true, only files
|
||||||
* otherwise
|
* otherwise
|
||||||
|
* @param bool $extension_keys If true, result will be associative array
|
||||||
|
* with extension name as key
|
||||||
* @return array An array of paths to found items
|
* @return array An array of paths to found items
|
||||||
*/
|
*/
|
||||||
protected function find_with_root_path($cache = true, $is_dir = false)
|
protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false)
|
||||||
{
|
{
|
||||||
$items = $this->find($cache, $is_dir);
|
$items = $this->find($cache, $is_dir);
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($items as $item => $ext_name)
|
foreach ($items as $item => $ext_name)
|
||||||
|
{
|
||||||
|
if ($extension_keys)
|
||||||
|
{
|
||||||
|
$result[$ext_name] = $this->phpbb_root_path . $item;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$result[] = $this->phpbb_root_path . $item;
|
$result[] = $this->phpbb_root_path . $item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,6 +352,10 @@ class phpbb_extension_manager
|
||||||
public function all_available()
|
public function all_available()
|
||||||
{
|
{
|
||||||
$available = array();
|
$available = array();
|
||||||
|
if (!is_dir($this->phpbb_root_path . 'ext/'))
|
||||||
|
{
|
||||||
|
return $available;
|
||||||
|
}
|
||||||
|
|
||||||
$iterator = new RecursiveIteratorIterator(
|
$iterator = new RecursiveIteratorIterator(
|
||||||
new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'),
|
new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'),
|
||||||
|
@ -429,6 +433,28 @@ class phpbb_extension_manager
|
||||||
return $disabled;
|
return $disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if a given extension is available on the filesystem
|
||||||
|
*
|
||||||
|
* @param string $name Extension name to check NOTE: Can be user input
|
||||||
|
* @return bool Depending on whether or not the extension is available
|
||||||
|
*/
|
||||||
|
public function available($name)
|
||||||
|
{
|
||||||
|
return file_exists($this->get_extension_path($name, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if a given extension is enabled
|
||||||
|
*
|
||||||
|
* @param string $name Extension name to check
|
||||||
|
* @return bool Depending on whether or not the extension is enabled
|
||||||
|
*/
|
||||||
|
public function enabled($name)
|
||||||
|
{
|
||||||
|
return isset($this->extensions[$name]) && $this->extensions[$name]['ext_active'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a phpbb_extension_finder.
|
* Instantiates a phpbb_extension_finder.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2448,8 +2448,17 @@ function build_url($strip_vars = false)
|
||||||
*/
|
*/
|
||||||
function meta_refresh($time, $url, $disable_cd_check = false)
|
function meta_refresh($time, $url, $disable_cd_check = false)
|
||||||
{
|
{
|
||||||
global $template;
|
global $template, $refresh_data, $request;
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$refresh_data = array(
|
||||||
|
'time' => $time,
|
||||||
|
'url' => str_replace('&', '&', $url)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$url = redirect($url, true, $disable_cd_check);
|
$url = redirect($url, true, $disable_cd_check);
|
||||||
$url = str_replace('&', '&', $url);
|
$url = str_replace('&', '&', $url);
|
||||||
|
|
||||||
|
@ -2457,6 +2466,7 @@ function meta_refresh($time, $url, $disable_cd_check = false)
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
|
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
@ -2619,7 +2629,7 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg
|
||||||
*/
|
*/
|
||||||
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '')
|
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '')
|
||||||
{
|
{
|
||||||
global $user, $template, $db;
|
global $user, $template, $db, $request;
|
||||||
global $phpEx, $phpbb_root_path, $request;
|
global $phpEx, $phpbb_root_path, $request;
|
||||||
|
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
|
@ -2699,6 +2709,21 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
WHERE user_id = " . $user->data['user_id'];
|
WHERE user_id = " . $user->data['user_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
|
||||||
|
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
|
||||||
|
|
||||||
|
'YES_VALUE' => $user->lang['YES'],
|
||||||
|
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function
|
||||||
|
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
||||||
{
|
{
|
||||||
adm_page_footer();
|
adm_page_footer();
|
||||||
|
@ -3092,9 +3117,9 @@ function parse_cfg_file($filename, $lines = false)
|
||||||
$parsed_items[$key] = $value;
|
$parsed_items[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($parsed_items['inherit_from']) && isset($parsed_items['name']) && $parsed_items['inherit_from'] == $parsed_items['name'])
|
if (isset($parsed_items['parent']) && isset($parsed_items['name']) && $parsed_items['parent'] == $parsed_items['name'])
|
||||||
{
|
{
|
||||||
unset($parsed_items['inherit_from']);
|
unset($parsed_items['parent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $parsed_items;
|
return $parsed_items;
|
||||||
|
@ -3723,7 +3748,7 @@ function phpbb_checkdnsrr($host, $type = 'MX')
|
||||||
*/
|
*/
|
||||||
function msg_handler($errno, $msg_text, $errfile, $errline)
|
function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
{
|
{
|
||||||
global $cache, $db, $auth, $template, $config, $user;
|
global $cache, $db, $auth, $template, $config, $user, $request;
|
||||||
global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text;
|
global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text;
|
||||||
|
|
||||||
// Do not display notices if we suppress them via @
|
// Do not display notices if we suppress them via @
|
||||||
|
@ -3922,6 +3947,20 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false)
|
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
global $refresh_data;
|
||||||
|
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $msg_title,
|
||||||
|
'MESSAGE_TEXT' => $msg_text,
|
||||||
|
'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false,
|
||||||
|
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false,
|
||||||
|
'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// We do not want the cron script to be called on error messages
|
// We do not want the cron script to be called on error messages
|
||||||
define('IN_CRON', true);
|
define('IN_CRON', true);
|
||||||
|
|
||||||
|
@ -4478,6 +4517,7 @@ function phpbb_http_login($param)
|
||||||
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
|
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
|
||||||
{
|
{
|
||||||
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
|
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
|
||||||
|
global $phpbb_dispatcher;
|
||||||
|
|
||||||
if (defined('HEADER_INC'))
|
if (defined('HEADER_INC'))
|
||||||
{
|
{
|
||||||
|
@ -4728,9 +4768,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
|
'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
|
||||||
|
|
||||||
'T_ASSETS_PATH' => "{$web_path}assets",
|
'T_ASSETS_PATH' => "{$web_path}assets",
|
||||||
'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme',
|
'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme',
|
||||||
'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['template_path']) . '/template',
|
'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
|
||||||
'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . rawurlencode($user->theme['template_inherit_path']) . '/template' : "{$web_path}styles/" . rawurlencode($user->theme['template_path']) . '/template',
|
'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/template',
|
||||||
'T_IMAGES_PATH' => "{$web_path}images/",
|
'T_IMAGES_PATH' => "{$web_path}images/",
|
||||||
'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/",
|
'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/",
|
||||||
'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/",
|
'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/",
|
||||||
|
@ -4738,16 +4778,16 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/",
|
'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/",
|
||||||
'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/",
|
'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/",
|
||||||
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
|
'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/",
|
||||||
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme/stylesheet.css',
|
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme/stylesheet.css',
|
||||||
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['theme_path']) . '/theme/' . $user->lang_name . '/stylesheet.css',
|
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . rawurlencode($user->theme['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css',
|
||||||
'T_STYLESHEET_NAME' => $user->theme['theme_name'],
|
'T_STYLESHEET_NAME' => $user->theme['style_name'],
|
||||||
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js",
|
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js",
|
||||||
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
|
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
|
||||||
|
|
||||||
'T_THEME_NAME' => rawurlencode($user->theme['theme_path']),
|
'T_THEME_NAME' => rawurlencode($user->theme['style_path']),
|
||||||
'T_THEME_LANG_NAME' => $user->data['user_lang'],
|
'T_THEME_LANG_NAME' => $user->data['user_lang'],
|
||||||
'T_TEMPLATE_NAME' => $user->theme['template_path'],
|
'T_TEMPLATE_NAME' => $user->theme['style_path'],
|
||||||
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? $user->theme['template_inherit_path'] : $user->theme['template_path']),
|
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->theme['style_parent_tree']) && $user->theme['style_parent_tree']) ? $user->theme['style_parent_tree'] : $user->theme['style_path']),
|
||||||
'T_IMAGES' => 'images',
|
'T_IMAGES' => 'images',
|
||||||
'T_SMILIES' => $config['smilies_path'],
|
'T_SMILIES' => $config['smilies_path'],
|
||||||
'T_AVATAR' => $config['avatar_path'],
|
'T_AVATAR' => $config['avatar_path'],
|
||||||
|
@ -4761,6 +4801,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
|
'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$vars = array('page_title', 'display_online_list', 'item_id', 'item');
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars)));
|
||||||
|
|
||||||
// application/xhtml+xml not used because of IE
|
// application/xhtml+xml not used because of IE
|
||||||
header('Content-type: text/html; charset=UTF-8');
|
header('Content-type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
|
@ -4817,6 +4860,7 @@ function page_footer($run_cron = true)
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
||||||
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
||||||
|
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'),
|
||||||
|
|
||||||
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '')
|
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '')
|
||||||
);
|
);
|
||||||
|
@ -4906,7 +4950,7 @@ function exit_handler()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for init calls in phpBB. This function is called in user::setup();
|
* Handler for init calls in phpBB. This function is called in phpbb_user::setup();
|
||||||
* This function supports hooks.
|
* This function supports hooks.
|
||||||
*/
|
*/
|
||||||
function phpbb_user_session_handler()
|
function phpbb_user_session_handler()
|
||||||
|
|
|
@ -131,6 +131,7 @@ function adm_page_footer($copyright_html = true)
|
||||||
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '',
|
||||||
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
||||||
'S_COPYRIGHT_HTML' => $copyright_html,
|
'S_COPYRIGHT_HTML' => $copyright_html,
|
||||||
|
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'),
|
||||||
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js",
|
'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.js",
|
||||||
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
|
'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
|
||||||
'VERSION' => $config['version'])
|
'VERSION' => $config['version'])
|
||||||
|
|
|
@ -739,7 +739,7 @@ function smiley_text($text, $force_option = false)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
|
$root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
|
||||||
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
|
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,6 +1258,22 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
|
||||||
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
|
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an option to the quick-mod tools.
|
||||||
|
*
|
||||||
|
* @param string $option The language key for the value of the option.
|
||||||
|
* @param string $lang_string The language string to use.
|
||||||
|
*/
|
||||||
|
function phpbb_add_quickmod_option($option, $lang_string)
|
||||||
|
{
|
||||||
|
global $template, $user;
|
||||||
|
$lang_string = $user->lang($lang_string);
|
||||||
|
$template->assign_block_vars('quickmod', array(
|
||||||
|
'VALUE' => $option,
|
||||||
|
'TITLE' => $lang_string,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -273,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
markread('topics', $forum_ids);
|
markread('topics', $forum_ids);
|
||||||
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
|
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
|
||||||
meta_refresh(3, $redirect);
|
meta_refresh(3, $redirect);
|
||||||
|
|
||||||
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
|
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -201,17 +201,18 @@ class messenger
|
||||||
{
|
{
|
||||||
// fall back to board default language if the user's language is
|
// fall back to board default language if the user's language is
|
||||||
// missing $template_file. If this does not exist either,
|
// missing $template_file. If this does not exist either,
|
||||||
// $tpl->set_custom_template will do a trigger_error
|
// $tpl->set_filenames will do a trigger_error
|
||||||
$template_lang = basename($config['default_lang']);
|
$template_lang = basename($config['default_lang']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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]))
|
||||||
{
|
{
|
||||||
$template_locator = new phpbb_template_locator();
|
$style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$template_path_provider = new phpbb_template_extension_path_provider($phpbb_extension_manager, new phpbb_template_path_provider());
|
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
|
||||||
$this->tpl_msg[$template_lang . $template_file] = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator, $template_path_provider);
|
$tpl = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider);
|
||||||
$tpl = &$this->tpl_msg[$template_lang . $template_file];
|
$stl = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
|
||||||
|
$this->tpl_msg[$template_lang . $template_file] = $tpl;
|
||||||
|
|
||||||
$fallback_template_path = false;
|
$fallback_template_path = false;
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ class messenger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl->set_custom_template($template_path, $template_lang . '_email', $fallback_template_path);
|
$stl->set_custom_style($template_lang . '_email', array($template_path, $fallback_template_path), '');
|
||||||
|
|
||||||
$tpl->set_filenames(array(
|
$tpl->set_filenames(array(
|
||||||
'body' => $template_file . '.txt',
|
'body' => $template_file . '.txt',
|
||||||
|
|
|
@ -128,7 +128,7 @@ class p_master
|
||||||
foreach ($this->module_cache['modules'] as $key => $row)
|
foreach ($this->module_cache['modules'] as $key => $row)
|
||||||
{
|
{
|
||||||
// Not allowed to view module?
|
// Not allowed to view module?
|
||||||
if (!$this->module_auth($row['module_auth']))
|
if (!$this->module_auth_self($row['module_auth']))
|
||||||
{
|
{
|
||||||
unset($this->module_cache['modules'][$key]);
|
unset($this->module_cache['modules'][$key]);
|
||||||
continue;
|
continue;
|
||||||
|
@ -315,9 +315,23 @@ class p_master
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check module authorisation
|
* Check module authorisation.
|
||||||
|
*
|
||||||
|
* This is a non-static version that uses $this->acl_forum_id
|
||||||
|
* for the forum id.
|
||||||
*/
|
*/
|
||||||
function module_auth($module_auth, $forum_id = false)
|
function module_auth_self($module_auth)
|
||||||
|
{
|
||||||
|
return self::module_auth($module_auth, $this->acl_forum_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check module authorisation.
|
||||||
|
*
|
||||||
|
* This is a static version, it must be given $forum_id.
|
||||||
|
* See also module_auth_self.
|
||||||
|
*/
|
||||||
|
static function module_auth($module_auth, $forum_id)
|
||||||
{
|
{
|
||||||
global $auth, $config;
|
global $auth, $config;
|
||||||
global $request;
|
global $request;
|
||||||
|
@ -362,11 +376,9 @@ class p_master
|
||||||
|
|
||||||
$module_auth = implode(' ', $tokens);
|
$module_auth = implode(' ', $tokens);
|
||||||
|
|
||||||
// Make sure $id seperation is working fine
|
// Make sure $id separation is working fine
|
||||||
$module_auth = str_replace(' , ', ',', $module_auth);
|
$module_auth = str_replace(' , ', ',', $module_auth);
|
||||||
|
|
||||||
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
|
|
||||||
|
|
||||||
$is_auth = false;
|
$is_auth = false;
|
||||||
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '$request->variable(\'\\1\', false)'), $module_auth) . ');');
|
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '$request->variable(\'\\1\', false)'), $module_auth) . ');');
|
||||||
|
|
||||||
|
|
|
@ -495,8 +495,15 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path']))
|
if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path']))
|
||||||
{
|
{
|
||||||
if ($free_space <= $file->get('filesize'))
|
if ($free_space <= $file->get('filesize'))
|
||||||
|
{
|
||||||
|
if ($auth->acl_get('a_'))
|
||||||
|
{
|
||||||
|
$filedata['error'][] = $user->lang['ATTACH_DISK_FULL'];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
|
$filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
|
||||||
|
}
|
||||||
$filedata['post_attach'] = false;
|
$filedata['post_attach'] = false;
|
||||||
|
|
||||||
$file->remove();
|
$file->remove();
|
||||||
|
@ -1180,36 +1187,32 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||||
$topic_title = ($topic_notification) ? $topic_title : $subject;
|
$topic_title = ($topic_notification) ? $topic_title : $subject;
|
||||||
$topic_title = censor_text($topic_title);
|
$topic_title = censor_text($topic_title);
|
||||||
|
|
||||||
// Get banned User ID's
|
// Exclude guests, current user and banned users from notifications
|
||||||
$sql = 'SELECT ban_userid
|
if (!function_exists('phpbb_get_banned_user_ids'))
|
||||||
FROM ' . BANLIST_TABLE . '
|
|
||||||
WHERE ban_userid <> 0
|
|
||||||
AND ban_exclude <> 1';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id'];
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
{
|
||||||
$sql_ignore_users .= ', ' . (int) $row['ban_userid'];
|
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$sql_ignore_users = phpbb_get_banned_user_ids();
|
||||||
|
$sql_ignore_users[ANONYMOUS] = ANONYMOUS;
|
||||||
|
$sql_ignore_users[$user->data['user_id']] = $user->data['user_id'];
|
||||||
|
|
||||||
$notify_rows = array();
|
$notify_rows = array();
|
||||||
|
|
||||||
// -- get forum_userids || topic_userids
|
// -- get forum_userids || topic_userids
|
||||||
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
|
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
|
||||||
FROM ' . (($topic_notification) ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u
|
FROM ' . (($topic_notification) ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u
|
||||||
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . "
|
WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . '
|
||||||
AND w.user_id NOT IN ($sql_ignore_users)
|
AND ' . $db->sql_in_set('w.user_id', $sql_ignore_users, true) . '
|
||||||
AND w.notify_status = " . NOTIFY_YES . '
|
AND w.notify_status = ' . NOTIFY_YES . '
|
||||||
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||||
AND u.user_id = w.user_id';
|
AND u.user_id = w.user_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$notify_rows[$row['user_id']] = array(
|
$notify_user_id = (int) $row['user_id'];
|
||||||
'user_id' => $row['user_id'],
|
$notify_rows[$notify_user_id] = array(
|
||||||
|
'user_id' => $notify_user_id,
|
||||||
'username' => $row['username'],
|
'username' => $row['username'],
|
||||||
'user_email' => $row['user_email'],
|
'user_email' => $row['user_email'],
|
||||||
'user_jabber' => $row['user_jabber'],
|
'user_jabber' => $row['user_jabber'],
|
||||||
|
@ -1219,30 +1222,29 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||||
'method' => $row['user_notify_type'],
|
'method' => $row['user_notify_type'],
|
||||||
'allowed' => false
|
'allowed' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add users who have been already notified to ignore list
|
||||||
|
$sql_ignore_users[$notify_user_id] = $notify_user_id;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// forum notification is sent to those not already receiving topic notifications
|
// forum notification is sent to those not already receiving topic notifications
|
||||||
if ($topic_notification)
|
if ($topic_notification)
|
||||||
{
|
{
|
||||||
if (sizeof($notify_rows))
|
|
||||||
{
|
|
||||||
$sql_ignore_users .= ', ' . implode(', ', array_keys($notify_rows));
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
|
$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
|
||||||
FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u
|
FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u
|
||||||
WHERE fw.forum_id = $forum_id
|
WHERE fw.forum_id = $forum_id
|
||||||
AND fw.user_id NOT IN ($sql_ignore_users)
|
AND " . $db->sql_in_set('fw.user_id', $sql_ignore_users, true) . '
|
||||||
AND fw.notify_status = " . NOTIFY_YES . '
|
AND fw.notify_status = ' . NOTIFY_YES . '
|
||||||
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
|
||||||
AND u.user_id = fw.user_id';
|
AND u.user_id = fw.user_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$notify_rows[$row['user_id']] = array(
|
$notify_user_id = (int) $row['user_id'];
|
||||||
'user_id' => $row['user_id'],
|
$notify_rows[$notify_user_id] = array(
|
||||||
|
'user_id' => $notify_user_id,
|
||||||
'username' => $row['username'],
|
'username' => $row['username'],
|
||||||
'user_email' => $row['user_email'],
|
'user_email' => $row['user_email'],
|
||||||
'user_jabber' => $row['user_jabber'],
|
'user_jabber' => $row['user_jabber'],
|
||||||
|
@ -1273,7 +1275,6 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Now, we have to do a little step before really sending, we need to distinguish our users a little bit. ;)
|
// Now, we have to do a little step before really sending, we need to distinguish our users a little bit. ;)
|
||||||
$msg_users = $delete_ids = $update_notification = array();
|
$msg_users = $delete_ids = $update_notification = array();
|
||||||
foreach ($notify_rows as $user_id => $row)
|
foreach ($notify_rows as $user_id => $row)
|
||||||
|
|
|
@ -343,7 +343,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
|
||||||
$userdata = $db->sql_fetchrow($result);
|
$userdata = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$auth2 = new auth();
|
$auth2 = new phpbb_auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
|
|
||||||
if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_'))
|
if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_'))
|
||||||
|
@ -1666,6 +1666,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
|
||||||
|
|
||||||
$subject = censor_text($subject);
|
$subject = censor_text($subject);
|
||||||
|
|
||||||
|
// Exclude guests, current user and banned users from notifications
|
||||||
unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]);
|
unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]);
|
||||||
|
|
||||||
if (!sizeof($recipients))
|
if (!sizeof($recipients))
|
||||||
|
@ -1673,18 +1674,12 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get banned User ID's
|
if (!function_exists('phpbb_get_banned_user_ids'))
|
||||||
$sql = 'SELECT ban_userid
|
|
||||||
FROM ' . BANLIST_TABLE . '
|
|
||||||
WHERE ' . $db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . '
|
|
||||||
AND ban_exclude = 0';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
{
|
||||||
unset($recipients[$row['ban_userid']]);
|
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$banned_users = phpbb_get_banned_user_ids(array_keys($recipients));
|
||||||
|
$recipients = array_diff(array_keys($recipients), $banned_users);
|
||||||
|
|
||||||
if (!sizeof($recipients))
|
if (!sizeof($recipients))
|
||||||
{
|
{
|
||||||
|
@ -1693,7 +1688,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
|
||||||
|
|
||||||
$sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
|
$sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($recipients)));
|
WHERE ' . $db->sql_in_set('user_id', $recipients);
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$msg_list_ary = array();
|
$msg_list_ary = array();
|
||||||
|
|
|
@ -555,7 +555,7 @@ class custom_profile
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
// Date should display as the same date for every user regardless of timezone, so remove offset
|
// Date should display as the same date for every user regardless of timezone, so remove offset
|
||||||
// to compensate for the offset added by user::format_date()
|
// to compensate for the offset added by phpbb_user::format_date()
|
||||||
return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
|
return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3692,3 +3692,36 @@ function remove_newly_registered($user_id, $user_data = false)
|
||||||
|
|
||||||
return $user_data['group_id'];
|
return $user_data['group_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets user ids of currently banned registered users.
|
||||||
|
*
|
||||||
|
* @param array $user_ids Array of users' ids to check for banning,
|
||||||
|
* leave empty to get complete list of banned ids
|
||||||
|
* @return array Array of banned users' ids if any, empty array otherwise
|
||||||
|
*/
|
||||||
|
function phpbb_get_banned_user_ids($user_ids = array())
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$sql_user_ids = (!empty($user_ids)) ? $db->sql_in_set('ban_userid', $user_ids) : 'ban_userid <> 0';
|
||||||
|
|
||||||
|
// Get banned User ID's
|
||||||
|
// Ignore stale bans which were not wiped yet
|
||||||
|
$banned_ids_list = array();
|
||||||
|
$sql = 'SELECT ban_userid
|
||||||
|
FROM ' . BANLIST_TABLE . "
|
||||||
|
WHERE $sql_user_ids
|
||||||
|
AND ban_exclude <> 1
|
||||||
|
AND (ban_end > " . time() . '
|
||||||
|
OR ban_end = 0)';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$user_id = (int) $row['ban_userid'];
|
||||||
|
$banned_ids_list[$user_id] = $user_id;
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
return $banned_ids_list;
|
||||||
|
}
|
||||||
|
|
41
phpBB/includes/json_response.php
Normal file
41
phpBB/includes/json_response.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON class
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_json_response
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Send the data to the client and exit the script.
|
||||||
|
*
|
||||||
|
* @param array $data Any additional data to send.
|
||||||
|
* @param bool $exit Will exit the script if true.
|
||||||
|
*/
|
||||||
|
public function send($data, $exit = true)
|
||||||
|
{
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
|
||||||
|
if ($exit)
|
||||||
|
{
|
||||||
|
garbage_collection();
|
||||||
|
exit_handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -451,6 +451,7 @@ function approve_post($post_id_list, $id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $template, $user, $config;
|
global $db, $template, $user, $config;
|
||||||
global $phpEx, $phpbb_root_path;
|
global $phpEx, $phpbb_root_path;
|
||||||
|
global $request;
|
||||||
|
|
||||||
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
||||||
{
|
{
|
||||||
|
@ -709,7 +710,20 @@ function approve_post($post_id_list, $id, $mode)
|
||||||
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
|
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message);
|
$message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message;
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $message,
|
||||||
|
'REFRESH_DATA' => null,
|
||||||
|
'approved' => true
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,7 +982,20 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>');
|
||||||
|
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $message,
|
||||||
|
'REFRESH_DATA' => null,
|
||||||
|
'approved' => false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
meta_refresh(3, $redirect);
|
meta_refresh(3, $redirect);
|
||||||
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class mcp_reports
|
||||||
// closed reports are accessed by report id
|
// closed reports are accessed by report id
|
||||||
$report_id = request_var('r', 0);
|
$report_id = request_var('r', 0);
|
||||||
|
|
||||||
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
|
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
|
||||||
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
|
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
|
||||||
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
|
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
|
||||||
AND rr.reason_id = r.reason_id
|
AND rr.reason_id = r.reason_id
|
||||||
|
@ -116,8 +116,9 @@ class mcp_reports
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_TOPIC_REVIEW' => true,
|
'S_TOPIC_REVIEW' => true,
|
||||||
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
|
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
|
||||||
'TOPIC_TITLE' => $post_info['topic_title'])
|
'TOPIC_TITLE' => $post_info['topic_title'],
|
||||||
);
|
'REPORTED_POST_ID' => $post_id,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic_tracking_info = $extensions = $attachments = array();
|
$topic_tracking_info = $extensions = $attachments = array();
|
||||||
|
@ -226,7 +227,7 @@ class mcp_reports
|
||||||
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
|
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
|
||||||
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
|
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
|
||||||
|
|
||||||
'POST_PREVIEW' => $message,
|
'POST_PREVIEW' => bbcode_nl2br($report['reported_post_text']),
|
||||||
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
|
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
|
||||||
'POST_DATE' => $user->format_date($post_info['post_time']),
|
'POST_DATE' => $user->format_date($post_info['post_time']),
|
||||||
'POST_IP' => $post_info['poster_ip'],
|
'POST_IP' => $post_info['poster_ip'],
|
||||||
|
|
|
@ -251,7 +251,7 @@ class mcp_warn
|
||||||
// Check if can send a notification
|
// Check if can send a notification
|
||||||
if ($config['allow_privmsg'])
|
if ($config['allow_privmsg'])
|
||||||
{
|
{
|
||||||
$auth2 = new auth();
|
$auth2 = new phpbb_auth();
|
||||||
$auth2->acl($user_row);
|
$auth2->acl($user_row);
|
||||||
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
||||||
unset($auth2);
|
unset($auth2);
|
||||||
|
@ -374,7 +374,7 @@ class mcp_warn
|
||||||
// Check if can send a notification
|
// Check if can send a notification
|
||||||
if ($config['allow_privmsg'])
|
if ($config['allow_privmsg'])
|
||||||
{
|
{
|
||||||
$auth2 = new auth();
|
$auth2 = new phpbb_auth();
|
||||||
$auth2->acl($user_row);
|
$auth2->acl($user_row);
|
||||||
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
||||||
unset($auth2);
|
unset($auth2);
|
||||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Session class
|
* Session class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class session
|
class phpbb_session
|
||||||
{
|
{
|
||||||
var $cookie_data = array();
|
var $cookie_data = array();
|
||||||
var $page = array();
|
var $page = array();
|
||||||
|
@ -1511,843 +1511,3 @@ class session
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base user class
|
|
||||||
*
|
|
||||||
* This is the overarching class which contains (through session extend)
|
|
||||||
* all methods utilised for user functionality during a session.
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class user extends session
|
|
||||||
{
|
|
||||||
var $lang = array();
|
|
||||||
var $help = array();
|
|
||||||
var $theme = array();
|
|
||||||
var $date_format;
|
|
||||||
var $timezone;
|
|
||||||
var $dst;
|
|
||||||
|
|
||||||
var $lang_name = false;
|
|
||||||
var $lang_id = false;
|
|
||||||
var $lang_path;
|
|
||||||
var $img_lang;
|
|
||||||
var $img_array = array();
|
|
||||||
|
|
||||||
// Able to add new options (up to id 31)
|
|
||||||
var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'popuppm' => 10, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to set the lang path
|
|
||||||
*/
|
|
||||||
function user()
|
|
||||||
{
|
|
||||||
global $phpbb_root_path;
|
|
||||||
|
|
||||||
$this->lang_path = $phpbb_root_path . 'language/';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to set custom language path (able to use directory outside of phpBB)
|
|
||||||
*
|
|
||||||
* @param string $lang_path New language path used.
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function set_custom_lang_path($lang_path)
|
|
||||||
{
|
|
||||||
$this->lang_path = $lang_path;
|
|
||||||
|
|
||||||
if (substr($this->lang_path, -1) != '/')
|
|
||||||
{
|
|
||||||
$this->lang_path .= '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup basic user-specific items (style, language, ...)
|
|
||||||
*/
|
|
||||||
function setup($lang_set = false, $style = false)
|
|
||||||
{
|
|
||||||
global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;
|
|
||||||
|
|
||||||
if ($this->data['user_id'] != ANONYMOUS)
|
|
||||||
{
|
|
||||||
$this->lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']);
|
|
||||||
|
|
||||||
$this->date_format = $this->data['user_dateformat'];
|
|
||||||
$this->timezone = $this->data['user_timezone'] * 3600;
|
|
||||||
$this->dst = $this->data['user_dst'] * 3600;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->lang_name = basename($config['default_lang']);
|
|
||||||
$this->date_format = $config['default_dateformat'];
|
|
||||||
$this->timezone = $config['board_timezone'] * 3600;
|
|
||||||
$this->dst = $config['board_dst'] * 3600;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a guest user is surfing, we try to guess his/her language first by obtaining the browser language
|
|
||||||
* If re-enabled we need to make sure only those languages installed are checked
|
|
||||||
* Commented out so we do not loose the code.
|
|
||||||
|
|
||||||
if ($request->header('Accept-Language'))
|
|
||||||
{
|
|
||||||
$accept_lang_ary = explode(',', $request->header('Accept-Language'));
|
|
||||||
|
|
||||||
foreach ($accept_lang_ary as $accept_lang)
|
|
||||||
{
|
|
||||||
// Set correct format ... guess full xx_YY form
|
|
||||||
$accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2));
|
|
||||||
$accept_lang = basename($accept_lang);
|
|
||||||
|
|
||||||
if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
|
|
||||||
{
|
|
||||||
$this->lang_name = $config['default_lang'] = $accept_lang;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No match on xx_YY so try xx
|
|
||||||
$accept_lang = substr($accept_lang, 0, 2);
|
|
||||||
$accept_lang = basename($accept_lang);
|
|
||||||
|
|
||||||
if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
|
|
||||||
{
|
|
||||||
$this->lang_name = $config['default_lang'] = $accept_lang;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// We include common language file here to not load it every time a custom language file is included
|
|
||||||
$lang = &$this->lang;
|
|
||||||
|
|
||||||
// Do not suppress error if in DEBUG_EXTRA mode
|
|
||||||
$include_result = (defined('DEBUG_EXTRA')) ? (include $this->lang_path . $this->lang_name . "/common.$phpEx") : (@include $this->lang_path . $this->lang_name . "/common.$phpEx");
|
|
||||||
|
|
||||||
if ($include_result === false)
|
|
||||||
{
|
|
||||||
die('Language file ' . $this->lang_path . $this->lang_name . "/common.$phpEx" . " couldn't be opened.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->add_lang($lang_set);
|
|
||||||
unset($lang_set);
|
|
||||||
|
|
||||||
$style_request = request_var('style', 0);
|
|
||||||
if ($style_request && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
|
|
||||||
{
|
|
||||||
global $SID, $_EXTRA_URL;
|
|
||||||
|
|
||||||
$style = $style_request;
|
|
||||||
$SID .= '&style=' . $style;
|
|
||||||
$_EXTRA_URL = array('style=' . $style);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Set up style
|
|
||||||
$style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_id
|
|
||||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
|
|
||||||
WHERE s.style_id = $style
|
|
||||||
AND t.template_id = s.template_id
|
|
||||||
AND c.theme_id = s.theme_id";
|
|
||||||
$result = $db->sql_query($sql, 3600);
|
|
||||||
$this->theme = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
// User has wrong style
|
|
||||||
if (!$this->theme && $style == $this->data['user_style'])
|
|
||||||
{
|
|
||||||
$style = $this->data['user_style'] = $config['default_style'];
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
|
||||||
SET user_style = $style
|
|
||||||
WHERE user_id = {$this->data['user_id']}";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
$sql = 'SELECT s.style_id, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_id
|
|
||||||
FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . " c
|
|
||||||
WHERE s.style_id = $style
|
|
||||||
AND t.template_id = s.template_id
|
|
||||||
AND c.theme_id = s.theme_id";
|
|
||||||
$result = $db->sql_query($sql, 3600);
|
|
||||||
$this->theme = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->theme)
|
|
||||||
{
|
|
||||||
trigger_error('Could not get style data', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now parse the cfg file and cache it
|
|
||||||
$parsed_items = $cache->obtain_cfg_items($this->theme);
|
|
||||||
|
|
||||||
// We are only interested in the theme configuration for now
|
|
||||||
$parsed_items = $parsed_items['theme'];
|
|
||||||
|
|
||||||
$check_for = array(
|
|
||||||
'pagination_sep' => (string) ', '
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($check_for as $key => $default_value)
|
|
||||||
{
|
|
||||||
$this->theme[$key] = (isset($parsed_items[$key])) ? $parsed_items[$key] : $default_value;
|
|
||||||
settype($this->theme[$key], gettype($default_value));
|
|
||||||
|
|
||||||
if (is_string($default_value))
|
|
||||||
{
|
|
||||||
$this->theme[$key] = htmlspecialchars($this->theme[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->set_template();
|
|
||||||
|
|
||||||
$this->img_lang = $this->lang_name;
|
|
||||||
|
|
||||||
// Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes...
|
|
||||||
// After calling it we continue script execution...
|
|
||||||
phpbb_user_session_handler();
|
|
||||||
|
|
||||||
// If this function got called from the error handler we are finished here.
|
|
||||||
if (defined('IN_ERROR_HANDLER'))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable board if the install/ directory is still present
|
|
||||||
// For the brave development army we do not care about this, else we need to comment out this everytime we develop locally
|
|
||||||
if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
|
|
||||||
{
|
|
||||||
// Adjust the message slightly according to the permissions
|
|
||||||
if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))
|
|
||||||
{
|
|
||||||
$message = 'REMOVE_INSTALL';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
|
|
||||||
}
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is board disabled and user not an admin or moderator?
|
|
||||||
if ($config['board_disable'] && !defined('IN_LOGIN') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
|
|
||||||
{
|
|
||||||
if ($this->data['is_bot'])
|
|
||||||
{
|
|
||||||
send_status_line(503, 'Service Unavailable');
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is load exceeded?
|
|
||||||
if ($config['limit_load'] && $this->load !== false)
|
|
||||||
{
|
|
||||||
if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN'))
|
|
||||||
{
|
|
||||||
// Set board disabled to true to let the admins/mods get the proper notification
|
|
||||||
$config['board_disable'] = '1';
|
|
||||||
|
|
||||||
if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))
|
|
||||||
{
|
|
||||||
if ($this->data['is_bot'])
|
|
||||||
{
|
|
||||||
send_status_line(503, 'Service Unavailable');
|
|
||||||
}
|
|
||||||
trigger_error('BOARD_UNAVAILABLE');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->data['session_viewonline']))
|
|
||||||
{
|
|
||||||
// Make sure the user is able to hide his session
|
|
||||||
if (!$this->data['session_viewonline'])
|
|
||||||
{
|
|
||||||
// Reset online status if not allowed to hide the session...
|
|
||||||
if (!$auth->acl_get('u_hideonline'))
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE ' . SESSIONS_TABLE . '
|
|
||||||
SET session_viewonline = 1
|
|
||||||
WHERE session_user_id = ' . $this->data['user_id'];
|
|
||||||
$db->sql_query($sql);
|
|
||||||
$this->data['session_viewonline'] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!$this->data['user_allow_viewonline'])
|
|
||||||
{
|
|
||||||
// the user wants to hide and is allowed to -> cloaking device on.
|
|
||||||
if ($auth->acl_get('u_hideonline'))
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE ' . SESSIONS_TABLE . '
|
|
||||||
SET session_viewonline = 0
|
|
||||||
WHERE session_user_id = ' . $this->data['user_id'];
|
|
||||||
$db->sql_query($sql);
|
|
||||||
$this->data['session_viewonline'] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Does the user need to change their password? If so, redirect to the
|
|
||||||
// ucp profile reg_details page ... of course do not redirect if we're already in the ucp
|
|
||||||
if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400))
|
|
||||||
{
|
|
||||||
if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.$phpEx")
|
|
||||||
{
|
|
||||||
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=reg_details'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* More advanced language substitution
|
|
||||||
* Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms.
|
|
||||||
* Params are the language key and the parameters to be substituted.
|
|
||||||
* This function/functionality is inspired by SHS` and Ashe.
|
|
||||||
*
|
|
||||||
* Example call: <samp>$user->lang('NUM_POSTS_IN_QUEUE', 1);</samp>
|
|
||||||
*
|
|
||||||
* If the first parameter is an array, the elements are used as keys and subkeys to get the language entry:
|
|
||||||
* Example: <samp>$user->lang(array('datetime', 'AGO'), 1)</samp> uses $user->lang['datetime']['AGO'] as language entry.
|
|
||||||
*/
|
|
||||||
function lang()
|
|
||||||
{
|
|
||||||
$args = func_get_args();
|
|
||||||
$key = $args[0];
|
|
||||||
|
|
||||||
if (is_array($key))
|
|
||||||
{
|
|
||||||
$lang = &$this->lang[array_shift($key)];
|
|
||||||
|
|
||||||
foreach ($key as $_key)
|
|
||||||
{
|
|
||||||
$lang = &$lang[$_key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$lang = &$this->lang[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return if language string does not exist
|
|
||||||
if (!isset($lang) || (!is_string($lang) && !is_array($lang)))
|
|
||||||
{
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the language entry is a string, we simply mimic sprintf() behaviour
|
|
||||||
if (is_string($lang))
|
|
||||||
{
|
|
||||||
if (sizeof($args) == 1)
|
|
||||||
{
|
|
||||||
return $lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace key with language entry and simply pass along...
|
|
||||||
$args[0] = $lang;
|
|
||||||
return call_user_func_array('sprintf', $args);
|
|
||||||
}
|
|
||||||
else if (sizeof($lang) == 0)
|
|
||||||
{
|
|
||||||
// If the language entry is an empty array, we just return the language key
|
|
||||||
return $args[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// It is an array... now handle different nullar/singular/plural forms
|
|
||||||
$key_found = false;
|
|
||||||
|
|
||||||
// We now get the first number passed and will select the key based upon this number
|
|
||||||
for ($i = 1, $num_args = sizeof($args); $i < $num_args; $i++)
|
|
||||||
{
|
|
||||||
if (is_int($args[$i]) || is_float($args[$i]))
|
|
||||||
{
|
|
||||||
if ($args[$i] == 0 && isset($lang[0]))
|
|
||||||
{
|
|
||||||
// We allow each translation using plural forms to specify a version for the case of 0 things,
|
|
||||||
// so that "0 users" may be displayed as "No users".
|
|
||||||
$key_found = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$use_plural_form = $this->get_plural_form($args[$i]);
|
|
||||||
if (isset($lang[$use_plural_form]))
|
|
||||||
{
|
|
||||||
// The key we should use exists, so we use it.
|
|
||||||
$key_found = $use_plural_form;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If the key we need to use does not exist, we fall back to the previous one.
|
|
||||||
$numbers = array_keys($lang);
|
|
||||||
|
|
||||||
foreach ($numbers as $num)
|
|
||||||
{
|
|
||||||
if ($num > $use_plural_form)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$key_found = $num;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ok, let's check if the key was found, else use the last entry (because it is mostly the plural form)
|
|
||||||
if ($key_found === false)
|
|
||||||
{
|
|
||||||
$numbers = array_keys($lang);
|
|
||||||
$key_found = end($numbers);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the language string we determined and pass it to sprintf()
|
|
||||||
$args[0] = $lang[$key_found];
|
|
||||||
return call_user_func_array('sprintf', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine which plural form we should use.
|
|
||||||
* For some languages this is not as simple as for English.
|
|
||||||
*
|
|
||||||
* @param $number int|float The number we want to get the plural case for. Float numbers are floored.
|
|
||||||
* @param $force_rule mixed False to use the plural rule of the language package
|
|
||||||
* or an integer to force a certain plural rule
|
|
||||||
* @return int The plural-case we need to use for the number plural-rule combination
|
|
||||||
*/
|
|
||||||
function get_plural_form($number, $force_rule = false)
|
|
||||||
{
|
|
||||||
$number = (int) $number;
|
|
||||||
|
|
||||||
// Default to English system
|
|
||||||
$plural_rule = ($force_rule !== false) ? $force_rule : ((isset($this->lang['PLURAL_RULE'])) ? $this->lang['PLURAL_RULE'] : 1);
|
|
||||||
|
|
||||||
return phpbb_get_plural_form($plural_rule, $number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion)
|
|
||||||
*
|
|
||||||
* @param mixed $lang_set specifies the language entries to include
|
|
||||||
* @param bool $use_db internal variable for recursion, do not use
|
|
||||||
* @param bool $use_help internal variable for recursion, do not use
|
|
||||||
* @param string $ext_name The extension to load language from, or empty for core files
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* <code>
|
|
||||||
* $lang_set = array('posting', 'help' => 'faq');
|
|
||||||
* $lang_set = array('posting', 'viewtopic', 'help' => array('bbcode', 'faq'))
|
|
||||||
* $lang_set = array(array('posting', 'viewtopic'), 'help' => array('bbcode', 'faq'))
|
|
||||||
* $lang_set = 'posting'
|
|
||||||
* $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting'))
|
|
||||||
* </code>
|
|
||||||
*/
|
|
||||||
function add_lang($lang_set, $use_db = false, $use_help = false, $ext_name = '')
|
|
||||||
{
|
|
||||||
global $phpEx;
|
|
||||||
|
|
||||||
if (is_array($lang_set))
|
|
||||||
{
|
|
||||||
foreach ($lang_set as $key => $lang_file)
|
|
||||||
{
|
|
||||||
// Please do not delete this line.
|
|
||||||
// We have to force the type here, else [array] language inclusion will not work
|
|
||||||
$key = (string) $key;
|
|
||||||
|
|
||||||
if ($key == 'db')
|
|
||||||
{
|
|
||||||
$this->add_lang($lang_file, true, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
else if ($key == 'help')
|
|
||||||
{
|
|
||||||
$this->add_lang($lang_file, $use_db, true, $ext_name);
|
|
||||||
}
|
|
||||||
else if (!is_array($lang_file))
|
|
||||||
{
|
|
||||||
$this->set_lang($this->lang, $this->help, $lang_file, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->add_lang($lang_file, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($lang_set);
|
|
||||||
}
|
|
||||||
else if ($lang_set)
|
|
||||||
{
|
|
||||||
$this->set_lang($this->lang, $this->help, $lang_set, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Language Items from an extension - use_db and use_help are assigned where needed (only use them to force inclusion)
|
|
||||||
*
|
|
||||||
* @param string $ext_name The extension to load language from, or empty for core files
|
|
||||||
* @param mixed $lang_set specifies the language entries to include
|
|
||||||
* @param bool $use_db internal variable for recursion, do not use
|
|
||||||
* @param bool $use_help internal variable for recursion, do not use
|
|
||||||
*/
|
|
||||||
function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false)
|
|
||||||
{
|
|
||||||
if ($ext_name === '/')
|
|
||||||
{
|
|
||||||
$ext_name = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->add_lang($lang_set, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set language entry (called by add_lang)
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false, $ext_name = '')
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
// Make sure the language name is set (if the user setup did not happen it is not set)
|
|
||||||
if (!$this->lang_name)
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
$this->lang_name = basename($config['default_lang']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $lang == $this->lang
|
|
||||||
// $help == $this->help
|
|
||||||
// - add appropriate variables here, name them as they are used within the language file...
|
|
||||||
if (!$use_db)
|
|
||||||
{
|
|
||||||
if ($use_help && strpos($lang_file, '/') !== false)
|
|
||||||
{
|
|
||||||
$filename = dirname($lang_file) . '/help_' . basename($lang_file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$filename = (($use_help) ? 'help_' : '') . $lang_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ext_name)
|
|
||||||
{
|
|
||||||
global $phpbb_extension_manager;
|
|
||||||
$ext_path = $phpbb_extension_manager->get_extension_path($ext_name, true);
|
|
||||||
|
|
||||||
$lang_path = $ext_path . 'language/';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$lang_path = $this->lang_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($phpbb_root_path . $filename, $lang_path . $this->lang_name . '/') === 0)
|
|
||||||
{
|
|
||||||
$language_filename = $phpbb_root_path . $filename;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$language_filename = $lang_path . $this->lang_name . '/' . $filename . '.' . $phpEx;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists($language_filename))
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
if ($this->lang_name == 'en')
|
|
||||||
{
|
|
||||||
// The user's selected language is missing the file, the board default's language is missing the file, and the file doesn't exist in /en.
|
|
||||||
$language_filename = str_replace($lang_path . 'en', $lang_path . $this->data['user_lang'], $language_filename);
|
|
||||||
trigger_error('Language file ' . $language_filename . ' couldn\'t be opened.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
else if ($this->lang_name == basename($config['default_lang']))
|
|
||||||
{
|
|
||||||
// Fall back to the English Language
|
|
||||||
$this->lang_name = 'en';
|
|
||||||
$this->set_lang($lang, $help, $lang_file, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
else if ($this->lang_name == $this->data['user_lang'])
|
|
||||||
{
|
|
||||||
// Fall back to the board default language
|
|
||||||
$this->lang_name = basename($config['default_lang']);
|
|
||||||
$this->set_lang($lang, $help, $lang_file, $use_db, $use_help, $ext_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the lang name
|
|
||||||
$this->lang_name = (file_exists($lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not suppress error if in DEBUG_EXTRA mode
|
|
||||||
$include_result = (defined('DEBUG_EXTRA')) ? (include $language_filename) : (@include $language_filename);
|
|
||||||
|
|
||||||
if ($include_result === false)
|
|
||||||
{
|
|
||||||
trigger_error('Language file ' . $language_filename . ' couldn\'t be opened.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($use_db)
|
|
||||||
{
|
|
||||||
// Get Database Language Strings
|
|
||||||
// Put them into $lang if nothing is prefixed, put them into $help if help: is prefixed
|
|
||||||
// For example: help:faq, posting
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format user date
|
|
||||||
*
|
|
||||||
* @param int $gmepoch unix timestamp
|
|
||||||
* @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i.
|
|
||||||
* @param bool $forcedate force non-relative date format.
|
|
||||||
*
|
|
||||||
* @return mixed translated date
|
|
||||||
*/
|
|
||||||
function format_date($gmepoch, $format = false, $forcedate = false)
|
|
||||||
{
|
|
||||||
static $midnight;
|
|
||||||
static $date_cache;
|
|
||||||
|
|
||||||
$format = (!$format) ? $this->date_format : $format;
|
|
||||||
$now = time();
|
|
||||||
$delta = $now - $gmepoch;
|
|
||||||
|
|
||||||
if (!isset($date_cache[$format]))
|
|
||||||
{
|
|
||||||
// Is the user requesting a friendly date format (i.e. 'Today 12:42')?
|
|
||||||
$date_cache[$format] = array(
|
|
||||||
'is_short' => strpos($format, '|'),
|
|
||||||
'format_short' => substr($format, 0, strpos($format, '|')) . '||' . substr(strrchr($format, '|'), 1),
|
|
||||||
'format_long' => str_replace('|', '', $format),
|
|
||||||
'lang' => $this->lang['datetime'],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Short representation of month in format? Some languages use different terms for the long and short format of May
|
|
||||||
if ((strpos($format, '\M') === false && strpos($format, 'M') !== false) || (strpos($format, '\r') === false && strpos($format, 'r') !== false))
|
|
||||||
{
|
|
||||||
$date_cache[$format]['lang']['May'] = $this->lang['datetime']['May_short'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Zone offset
|
|
||||||
$zone_offset = $this->timezone + $this->dst;
|
|
||||||
|
|
||||||
// Show date < 1 hour ago as 'xx min ago' but not greater than 60 seconds in the future
|
|
||||||
// A small tolerence is given for times in the future but in the same minute are displayed as '< than a minute ago'
|
|
||||||
if ($delta < 3600 && $delta > -60 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO']))
|
|
||||||
{
|
|
||||||
return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$midnight)
|
|
||||||
{
|
|
||||||
list($d, $m, $y) = explode(' ', gmdate('j n Y', time() + $zone_offset));
|
|
||||||
$midnight = gmmktime(0, 0, 0, $m, $d, $y) - $zone_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($date_cache[$format]['is_short'] !== false && !$forcedate && !($gmepoch < $midnight - 86400 || $gmepoch > $midnight + 172800))
|
|
||||||
{
|
|
||||||
$day = false;
|
|
||||||
|
|
||||||
if ($gmepoch > $midnight + 86400)
|
|
||||||
{
|
|
||||||
$day = 'TOMORROW';
|
|
||||||
}
|
|
||||||
else if ($gmepoch > $midnight)
|
|
||||||
{
|
|
||||||
$day = 'TODAY';
|
|
||||||
}
|
|
||||||
else if ($gmepoch > $midnight - 86400)
|
|
||||||
{
|
|
||||||
$day = 'YESTERDAY';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($day !== false)
|
|
||||||
{
|
|
||||||
return str_replace('||', $this->lang['datetime'][$day], strtr(@gmdate($date_cache[$format]['format_short'], $gmepoch + $zone_offset), $date_cache[$format]['lang']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return strtr(@gmdate($date_cache[$format]['format_long'], $gmepoch + $zone_offset), $date_cache[$format]['lang']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get language id currently used by the user
|
|
||||||
*/
|
|
||||||
function get_iso_lang_id()
|
|
||||||
{
|
|
||||||
global $config, $db;
|
|
||||||
|
|
||||||
if (!empty($this->lang_id))
|
|
||||||
{
|
|
||||||
return $this->lang_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->lang_name)
|
|
||||||
{
|
|
||||||
$this->lang_name = $config['default_lang'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT lang_id
|
|
||||||
FROM ' . LANG_TABLE . "
|
|
||||||
WHERE lang_iso = '" . $db->sql_escape($this->lang_name) . "'";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$this->lang_id = (int) $db->sql_fetchfield('lang_id');
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
return $this->lang_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get users profile fields
|
|
||||||
*/
|
|
||||||
function get_profile_fields($user_id)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (isset($this->profile_fields))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'SELECT *
|
|
||||||
FROM ' . PROFILE_FIELDS_DATA_TABLE . "
|
|
||||||
WHERE user_id = $user_id";
|
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
|
||||||
$this->profile_fields = (!($row = $db->sql_fetchrow($result))) ? array() : $row;
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify/Get image
|
|
||||||
*/
|
|
||||||
function img($img, $alt = '')
|
|
||||||
{
|
|
||||||
$alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : $alt;
|
|
||||||
return '<span class="imageset ' . $img . '">' . $alt . '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get option bit field from user options.
|
|
||||||
*
|
|
||||||
* @param int $key option key, as defined in $keyoptions property.
|
|
||||||
* @param int $data bit field value to use, or false to use $this->data['user_options']
|
|
||||||
* @return bool true if the option is set in the bit field, false otherwise
|
|
||||||
*/
|
|
||||||
function optionget($key, $data = false)
|
|
||||||
{
|
|
||||||
$var = ($data !== false) ? $data : $this->data['user_options'];
|
|
||||||
return phpbb_optionget($this->keyoptions[$key], $var);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set option bit field for user options.
|
|
||||||
*
|
|
||||||
* @param int $key Option key, as defined in $keyoptions property.
|
|
||||||
* @param bool $value True to set the option, false to clear the option.
|
|
||||||
* @param int $data Current bit field value, or false to use $this->data['user_options']
|
|
||||||
* @return int|bool If $data is false, the bit field is modified and
|
|
||||||
* written back to $this->data['user_options'], and
|
|
||||||
* return value is true if the bit field changed and
|
|
||||||
* false otherwise. If $data is not false, the new
|
|
||||||
* bitfield value is returned.
|
|
||||||
*/
|
|
||||||
function optionset($key, $value, $data = false)
|
|
||||||
{
|
|
||||||
$var = ($data !== false) ? $data : $this->data['user_options'];
|
|
||||||
|
|
||||||
$new_var = phpbb_optionset($this->keyoptions[$key], $value, $var);
|
|
||||||
|
|
||||||
if ($data === false)
|
|
||||||
{
|
|
||||||
if ($new_var != $var)
|
|
||||||
{
|
|
||||||
$this->data['user_options'] = $new_var;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $new_var;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Funtion to make the user leave the NEWLY_REGISTERED system group.
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function leave_newly_registered()
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (empty($this->data['user_new']))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('remove_newly_registered'))
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
||||||
}
|
|
||||||
if ($group = remove_newly_registered($this->data['user_id'], $this->data))
|
|
||||||
{
|
|
||||||
$this->data['group_id'] = $group;
|
|
||||||
|
|
||||||
}
|
|
||||||
$this->data['user_permissions'] = '';
|
|
||||||
$this->data['user_new'] = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all password protected forum ids the user is currently NOT authenticated for.
|
|
||||||
*
|
|
||||||
* @return array Array of forum ids
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
function get_passworded_forums()
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql = 'SELECT f.forum_id, fa.user_id
|
|
||||||
FROM ' . FORUMS_TABLE . ' f
|
|
||||||
LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa
|
|
||||||
ON (fa.forum_id = f.forum_id
|
|
||||||
AND fa.session_id = '" . $db->sql_escape($this->session_id) . "')
|
|
||||||
WHERE f.forum_password <> ''";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
$forum_ids = array();
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$forum_id = (int) $row['forum_id'];
|
|
||||||
|
|
||||||
if ($row['user_id'] != $this->data['user_id'])
|
|
||||||
{
|
|
||||||
$forum_ids[$forum_id] = $forum_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
return $forum_ids;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ if (!defined('E_DEPRECATED'))
|
||||||
{
|
{
|
||||||
define('E_DEPRECATED', 8192);
|
define('E_DEPRECATED', 8192);
|
||||||
}
|
}
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
|
$level = E_ALL & ~E_NOTICE & ~E_DEPRECATED;
|
||||||
|
error_reporting($level);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove variables created by register_globals from the global scope
|
* Remove variables created by register_globals from the global scope
|
||||||
|
@ -146,5 +147,36 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Autoloading of dependencies.
|
||||||
|
// Three options are supported:
|
||||||
|
// 1. If dependencies are installed with Composer, Composer will create a
|
||||||
|
// vendor/.composer/autoload.php. If this file exists it will be
|
||||||
|
// automatically used by phpBB. This is the default mode that phpBB
|
||||||
|
// will use when shipped.
|
||||||
|
// 2. To disable composer autoloading, PHPBB_NO_COMPOSER_AUTOLOAD can be specified.
|
||||||
|
// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the
|
||||||
|
// environment. This is useful for running CLI scripts and tests.
|
||||||
|
// /path/to/autoload.php should define and register class loaders
|
||||||
|
// for all of phpBB's dependencies.
|
||||||
|
// 3. You can also set PHPBB_NO_COMPOSER_AUTOLOAD without setting PHPBB_AUTOLOAD.
|
||||||
|
// In this case autoloading needs to be defined before running any phpBB
|
||||||
|
// script. This might be useful in cases when phpBB is integrated into a
|
||||||
|
// larger program.
|
||||||
|
if (getenv('PHPBB_NO_COMPOSER_AUTOLOAD'))
|
||||||
|
{
|
||||||
|
if (getenv('PHPBB_AUTOLOAD'))
|
||||||
|
{
|
||||||
|
require(getenv('PHPBB_AUTOLOAD'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!file_exists($phpbb_root_path . 'vendor/.composer/autoload.php'))
|
||||||
|
{
|
||||||
|
trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
require($phpbb_root_path . 'vendor/.composer/autoload.php');
|
||||||
|
}
|
||||||
|
|
||||||
$starttime = explode(' ', microtime());
|
$starttime = explode(' ', microtime());
|
||||||
$starttime = $starttime[1] + $starttime[0];
|
$starttime = $starttime[1] + $starttime[0];
|
||||||
|
|
119
phpBB/includes/style/extension_path_provider.php
Normal file
119
phpBB/includes/style/extension_path_provider.php
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a style resource locator with core style paths and extension style paths
|
||||||
|
*
|
||||||
|
* Finds installed style paths and makes them available to the resource locator.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Optional prefix for style paths searched within extensions.
|
||||||
|
*
|
||||||
|
* Empty by default. Relative to the extension directory. As an example, it
|
||||||
|
* could be adm/ for admin style.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $ext_dir_prefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A provider of paths to be searched for styles
|
||||||
|
* @var phpbb_style_path_provider
|
||||||
|
*/
|
||||||
|
protected $base_path_provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor stores extension manager
|
||||||
|
*
|
||||||
|
* @param phpbb_extension_manager $extension_manager phpBB extension manager
|
||||||
|
* @param phpbb_style_path_provider $base_path_provider A simple path provider
|
||||||
|
* to provide paths to be located in extensions
|
||||||
|
*/
|
||||||
|
public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider)
|
||||||
|
{
|
||||||
|
parent::__construct($extension_manager);
|
||||||
|
$this->base_path_provider = $base_path_provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a prefix for style paths searched within extensions.
|
||||||
|
*
|
||||||
|
* The prefix is inserted between the extension's path e.g. ext/foo/ and
|
||||||
|
* the looked up style path, e.g. styles/bar/. So it should not have a
|
||||||
|
* leading slash, but should have a trailing slash.
|
||||||
|
*
|
||||||
|
* @param string $ext_dir_prefix The prefix including trailing slash
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_ext_dir_prefix($ext_dir_prefix)
|
||||||
|
{
|
||||||
|
$this->ext_dir_prefix = $ext_dir_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds style paths using the extension manager
|
||||||
|
*
|
||||||
|
* Locates a path (e.g. styles/prosilver/) in all active extensions.
|
||||||
|
* Then appends the core style paths based in the current working
|
||||||
|
* directory.
|
||||||
|
*
|
||||||
|
* @return array List of style paths
|
||||||
|
*/
|
||||||
|
public function find()
|
||||||
|
{
|
||||||
|
$directories = array();
|
||||||
|
|
||||||
|
$finder = $this->extension_manager->get_finder();
|
||||||
|
foreach ($this->base_path_provider as $key => $paths)
|
||||||
|
{
|
||||||
|
if ($key == 'style')
|
||||||
|
{
|
||||||
|
foreach ($paths as $path)
|
||||||
|
{
|
||||||
|
$directories['style'][] = $path;
|
||||||
|
if ($path && !phpbb_is_absolute($path))
|
||||||
|
{
|
||||||
|
$result = $finder->directory('/' . $this->ext_dir_prefix . $path)
|
||||||
|
->get_directories(true, true);
|
||||||
|
foreach ($result as $ext => $ext_path)
|
||||||
|
{
|
||||||
|
$directories[$ext][] = $ext_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrites the current style paths
|
||||||
|
*
|
||||||
|
* @param array $styles An array of style paths. The first element is the main style.
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_styles(array $styles)
|
||||||
|
{
|
||||||
|
$this->base_path_provider->set_styles($styles);
|
||||||
|
$this->items = null;
|
||||||
|
}
|
||||||
|
}
|
62
phpBB/includes/style/path_provider.php
Normal file
62
phpBB/includes/style/path_provider.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a style resource locator with paths
|
||||||
|
*
|
||||||
|
* Finds installed style paths and makes them available to the resource locator.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface
|
||||||
|
{
|
||||||
|
protected $paths = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ignores the extension dir prefix
|
||||||
|
*
|
||||||
|
* @param string $ext_dir_prefix The prefix including trailing slash
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_ext_dir_prefix($ext_dir_prefix)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrites the current style paths
|
||||||
|
*
|
||||||
|
* The first element of the passed styles map, is considered the main
|
||||||
|
* style.
|
||||||
|
*
|
||||||
|
* @param array $styles An array of style paths. The first element is the main style.
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_styles(array $styles)
|
||||||
|
{
|
||||||
|
$this->paths = array('style' => $styles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve an iterator over all style paths
|
||||||
|
*
|
||||||
|
* @return ArrayIterator An iterator for the array of style paths
|
||||||
|
*/
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new ArrayIterator($this->paths);
|
||||||
|
}
|
||||||
|
}
|
42
phpBB/includes/style/path_provider_interface.php
Normal file
42
phpBB/includes/style/path_provider_interface.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a style resource locator with paths
|
||||||
|
*
|
||||||
|
* Finds installed style paths and makes them available to the resource locator.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
interface phpbb_style_path_provider_interface extends Traversable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Defines a prefix to use for style paths in extensions
|
||||||
|
*
|
||||||
|
* @param string $ext_dir_prefix The prefix including trailing slash
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_ext_dir_prefix($ext_dir_prefix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrites the current style paths
|
||||||
|
*
|
||||||
|
* @param array $styles An array of style paths. The first element is the main style.
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_styles(array $styles);
|
||||||
|
}
|
291
phpBB/includes/style/resource_locator.php
Normal file
291
phpBB/includes/style/resource_locator.php
Normal file
|
@ -0,0 +1,291 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2011 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style resource locator.
|
||||||
|
* Maintains mapping from template handles to source template file paths.
|
||||||
|
* Locates style files: resources (such as .js and .css files) and templates.
|
||||||
|
*
|
||||||
|
* Style resource locator is aware of styles tree, and can return actual
|
||||||
|
* filesystem paths (i.e., the "child" style or the "parent" styles)
|
||||||
|
* depending on what files exist.
|
||||||
|
*
|
||||||
|
* Root paths stored in locator are paths to style directories. Templates are
|
||||||
|
* stored in subdirectory that $template_path points to.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_style_resource_locator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Paths to style directories.
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $roots = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of templates directory within style directories.
|
||||||
|
* Must have trailing slash. Empty if templates are stored in root
|
||||||
|
* style directory, such as admin control panel templates.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $template_path = 'template/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map from root index to 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.
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $files = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map from handles to source template file names.
|
||||||
|
* Covers the same data as $files property but maps to basenames
|
||||||
|
* instead of paths.
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $filenames = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the list of style paths
|
||||||
|
*
|
||||||
|
* These paths will be searched for style files in the provided order.
|
||||||
|
* Paths may be outside of phpBB, but templates loaded from these paths
|
||||||
|
* will still be cached.
|
||||||
|
*
|
||||||
|
* @param array $style_paths An array of paths to style directories
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_paths($style_paths)
|
||||||
|
{
|
||||||
|
$this->roots = array();
|
||||||
|
$this->files = array();
|
||||||
|
$this->filenames = array();
|
||||||
|
|
||||||
|
foreach ($style_paths as $key => $paths)
|
||||||
|
{
|
||||||
|
foreach ($paths as $path)
|
||||||
|
{
|
||||||
|
// Make sure $path has no ending slash
|
||||||
|
if (substr($path, -1) === '/')
|
||||||
|
{
|
||||||
|
$path = substr($path, 0, -1);
|
||||||
|
}
|
||||||
|
$this->roots[$key][] = $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("style resource locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->filename[$handle] = $filename;
|
||||||
|
|
||||||
|
foreach ($this->roots as $root_key => $root_paths)
|
||||||
|
{
|
||||||
|
foreach ($root_paths as $root_index => $root)
|
||||||
|
{
|
||||||
|
$this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $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("style resource 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 styles tree.
|
||||||
|
*
|
||||||
|
* This function returns the path in "primary" style 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 style
|
||||||
|
* directory if primary style has parent styles).
|
||||||
|
*
|
||||||
|
* 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 style 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['style'][0][$handle]))
|
||||||
|
{
|
||||||
|
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$source_file = $this->files['style'][0][$handle];
|
||||||
|
return $source_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the source file path for a template handle, accounting
|
||||||
|
* for styles tree 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 styles tree checks.
|
||||||
|
*
|
||||||
|
* @param string $handle Template handle (i.e. "friendly" template name)
|
||||||
|
* @param bool $find_all If true, each root path will be checked and function
|
||||||
|
* will return array of files instead of string and will not
|
||||||
|
* trigger a error if template does not exist
|
||||||
|
* @return string Source file path
|
||||||
|
*/
|
||||||
|
public function get_source_file_for_handle($handle, $find_all = false)
|
||||||
|
{
|
||||||
|
// If we don't have a file assigned to this handle, die.
|
||||||
|
if (!isset($this->files['style'][0][$handle]))
|
||||||
|
{
|
||||||
|
trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// locate a source file that exists
|
||||||
|
$source_file = $this->files['style'][0][$handle];
|
||||||
|
$tried = $source_file;
|
||||||
|
$found = false;
|
||||||
|
$found_all = array();
|
||||||
|
foreach ($this->roots as $root_key => $root_paths)
|
||||||
|
{
|
||||||
|
foreach ($root_paths as $root_index => $root)
|
||||||
|
{
|
||||||
|
$source_file = $this->files[$root_key][$root_index][$handle];
|
||||||
|
$tried .= ', ' . $source_file;
|
||||||
|
if (file_exists($source_file))
|
||||||
|
{
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($found)
|
||||||
|
{
|
||||||
|
if ($find_all)
|
||||||
|
{
|
||||||
|
$found_all[] = $source_file;
|
||||||
|
$found = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// search failed
|
||||||
|
if (!$found && !$find_all)
|
||||||
|
{
|
||||||
|
trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($find_all) ? $found_all : $source_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locates source file path, accounting for styles tree and verifying that
|
||||||
|
* the path exists.
|
||||||
|
*
|
||||||
|
* Unlike previous functions, this function works without template handle
|
||||||
|
* and it can search for more than one file. If more than one file name is
|
||||||
|
* specified, it will return location of file that it finds first.
|
||||||
|
*
|
||||||
|
* @param array $files List of files to locate.
|
||||||
|
* @param bool $return_default Determines what to return if file does not
|
||||||
|
* exist. If true, function will return location where file is
|
||||||
|
* supposed to be. If false, function will return false.
|
||||||
|
* @param bool $return_full_path If true, function will return full path
|
||||||
|
* to file. If false, function will return file name. This
|
||||||
|
* parameter can be used to check which one of set of files
|
||||||
|
* is available.
|
||||||
|
* @return string or boolean Source file path if file exists or $return_default is
|
||||||
|
* true. False if file does not exist and $return_default is false
|
||||||
|
*/
|
||||||
|
public function get_first_file_location($files, $return_default = false, $return_full_path = true)
|
||||||
|
{
|
||||||
|
// set default value
|
||||||
|
$default_result = false;
|
||||||
|
|
||||||
|
// check all available paths
|
||||||
|
foreach ($this->roots as $root_paths)
|
||||||
|
{
|
||||||
|
foreach ($root_paths as $path)
|
||||||
|
{
|
||||||
|
// check all files
|
||||||
|
foreach ($files as $filename)
|
||||||
|
{
|
||||||
|
$source_file = $path . '/' . $filename;
|
||||||
|
if (file_exists($source_file))
|
||||||
|
{
|
||||||
|
return ($return_full_path) ? $source_file : $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assign first file as result if $return_default is true
|
||||||
|
if ($return_default && $default_result === false)
|
||||||
|
{
|
||||||
|
$default_result = $source_file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// search failed
|
||||||
|
return $default_result;
|
||||||
|
}
|
||||||
|
}
|
181
phpBB/includes/style/style.php
Normal file
181
phpBB/includes/style/style.php
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base Style class.
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_style
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var phpbb_style_template Template class.
|
||||||
|
* Handles everything related to templates.
|
||||||
|
*/
|
||||||
|
private $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style resource locator
|
||||||
|
* @var phpbb_style_resource_locator
|
||||||
|
*/
|
||||||
|
private $locator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style path provider
|
||||||
|
* @var phpbb_style_path_provider
|
||||||
|
*/
|
||||||
|
private $provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $phpbb_root_path phpBB root path
|
||||||
|
* @param user $user current user
|
||||||
|
* @param phpbb_style_resource_locator $locator style resource locator
|
||||||
|
* @param phpbb_style_path_provider $provider style path provider
|
||||||
|
* @param phpbb_style_template $template template
|
||||||
|
*/
|
||||||
|
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_style_template $template)
|
||||||
|
{
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->phpEx = $phpEx;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->locator = $locator;
|
||||||
|
$this->provider = $provider;
|
||||||
|
$this->template = $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set style location based on (current) user's chosen style.
|
||||||
|
*/
|
||||||
|
public function set_style()
|
||||||
|
{
|
||||||
|
$style_name = $this->user->theme['style_path'];
|
||||||
|
$style_dirs = ($this->user->theme['style_parent_id']) ? array_reverse(explode('/', $this->user->theme['style_parent_tree'])) : array();
|
||||||
|
$paths = array($this->get_style_path($style_name));
|
||||||
|
foreach ($style_dirs as $dir)
|
||||||
|
{
|
||||||
|
$paths[] = $this->get_style_path($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add 'all' path, used as last fallback path by hooks and extensions
|
||||||
|
$paths[] = $this->get_style_path('all');
|
||||||
|
|
||||||
|
return $this->set_custom_style($style_name, $paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom style location (able to use directory outside of phpBB).
|
||||||
|
*
|
||||||
|
* Note: Templates are still compiled to phpBB's cache directory.
|
||||||
|
*
|
||||||
|
* @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver"
|
||||||
|
* @param array or string $paths Array of style paths, relative to current root directory
|
||||||
|
* @param string $template_path Path to templates, relative to style directory. False if path should not be changed.
|
||||||
|
*/
|
||||||
|
public function set_custom_style($name, $paths, $template_path = false)
|
||||||
|
{
|
||||||
|
if (is_string($paths))
|
||||||
|
{
|
||||||
|
$paths = array($paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->provider->set_styles($paths);
|
||||||
|
$this->locator->set_paths($this->provider);
|
||||||
|
|
||||||
|
$this->template->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $name) . '_';
|
||||||
|
|
||||||
|
$this->template->context = new phpbb_style_template_context();
|
||||||
|
|
||||||
|
if ($template_path !== false)
|
||||||
|
{
|
||||||
|
$this->template->template_path = $this->locator->template_path = $template_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get location of style directory for specific style_path
|
||||||
|
*
|
||||||
|
* @param string $path Style path, such as "prosilver"
|
||||||
|
* @return string Path to style directory, relative to current path
|
||||||
|
*/
|
||||||
|
public function get_style_path($path)
|
||||||
|
{
|
||||||
|
return $this->phpbb_root_path . 'styles/' . $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a prefix to use for style paths in extensions
|
||||||
|
*
|
||||||
|
* @param string $ext_dir_prefix The prefix including trailing slash
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function set_ext_dir_prefix($ext_dir_prefix)
|
||||||
|
{
|
||||||
|
$this->provider->set_ext_dir_prefix($ext_dir_prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locates source file path, accounting for styles tree and verifying that
|
||||||
|
* the path exists.
|
||||||
|
*
|
||||||
|
* @param string or array $files List of files to locate. If there is only
|
||||||
|
* one file, $files can be a string to make code easier to read.
|
||||||
|
* @param bool $return_default Determines what to return if file does not
|
||||||
|
* exist. If true, function will return location where file is
|
||||||
|
* supposed to be. If false, function will return false.
|
||||||
|
* @param bool $return_full_path If true, function will return full path
|
||||||
|
* to file. If false, function will return file name. This
|
||||||
|
* parameter can be used to check which one of set of files
|
||||||
|
* is available.
|
||||||
|
* @return string or boolean Source file path if file exists or $return_default is
|
||||||
|
* true. False if file does not exist and $return_default is false
|
||||||
|
*/
|
||||||
|
public function locate($files, $return_default = false, $return_full_path = true)
|
||||||
|
{
|
||||||
|
// convert string to array
|
||||||
|
if (is_string($files))
|
||||||
|
{
|
||||||
|
$files = array($files);
|
||||||
|
}
|
||||||
|
|
||||||
|
// use resource locator to find files
|
||||||
|
return $this->locator->get_first_file_location($files, $return_default, $return_full_path);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,13 +29,13 @@ if (!defined('IN_PHPBB'))
|
||||||
* Base Template class.
|
* Base Template class.
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_template
|
class phpbb_style_template
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var phpbb_template_context Template context.
|
* @var phpbb_style_template_context Template context.
|
||||||
* Stores template data used during template rendering.
|
* Stores template data used during template rendering.
|
||||||
*/
|
*/
|
||||||
private $context;
|
public $context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Path of the cache directory for the template
|
* @var string Path of the cache directory for the template
|
||||||
|
@ -63,87 +63,42 @@ class phpbb_template
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template locator
|
* Style resource locator
|
||||||
* @var phpbb_template_locator
|
* @var phpbb_style_resource_locator
|
||||||
*/
|
*/
|
||||||
private $locator;
|
private $locator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template path provider
|
* Template path provider
|
||||||
* @var phpbb_template_path_provider
|
* @var phpbb_style_path_provider
|
||||||
*/
|
*/
|
||||||
private $provider;
|
private $provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of templates directory within style directories
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $template_path = 'template/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param string $phpbb_root_path phpBB root path
|
* @param string $phpbb_root_path phpBB root path
|
||||||
* @param user $user current user
|
* @param user $user current user
|
||||||
* @param phpbb_template_locator $locator template locator
|
* @param phpbb_style_resource_locator $locator style resource locator
|
||||||
* @param phpbb_template_path_provider $provider template path provider
|
* @param phpbb_style_path_provider $provider style path provider
|
||||||
*/
|
*/
|
||||||
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_template_locator $locator, phpbb_template_path_provider_interface $provider)
|
public function __construct($phpbb_root_path, $phpEx, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider)
|
||||||
{
|
{
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->phpEx = $phpEx;
|
$this->phpEx = $phpEx;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->locator = $locator;
|
$this->locator = $locator;
|
||||||
|
$this->template_path = $this->locator->template_path;
|
||||||
$this->provider = $provider;
|
$this->provider = $provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set template location based on (current) user's chosen style.
|
|
||||||
*/
|
|
||||||
public function set_template()
|
|
||||||
{
|
|
||||||
$template_name = $this->user->theme['template_path'];
|
|
||||||
$fallback_name = ($this->user->theme['template_inherits_id']) ? $this->user->theme['template_inherit_path'] : false;
|
|
||||||
|
|
||||||
return $this->set_custom_template(false, $template_name, false, $fallback_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines a prefix to use for template paths in extensions
|
|
||||||
*
|
|
||||||
* @param string $ext_dir_prefix The prefix including trailing slash
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_ext_dir_prefix($ext_dir_prefix)
|
|
||||||
{
|
|
||||||
$this->provider->set_ext_dir_prefix($ext_dir_prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* @param string $fallback_template_name Name of fallback template
|
|
||||||
*/
|
|
||||||
public function set_custom_template($template_path, $template_name, $fallback_template_path = false, $fallback_template_name = false)
|
|
||||||
{
|
|
||||||
$templates = array($template_name => $template_path);
|
|
||||||
|
|
||||||
if ($fallback_template_name !== false)
|
|
||||||
{
|
|
||||||
$templates[$fallback_template_name] = $fallback_template_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->provider->set_templates($templates, $this->phpbb_root_path);
|
|
||||||
$this->locator->set_paths($this->provider);
|
|
||||||
$this->locator->set_main_template($this->provider->get_main_template_path());
|
|
||||||
|
|
||||||
$this->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $template_name) . '_';
|
|
||||||
|
|
||||||
$this->context = new phpbb_template_context();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the template filenames for handles.
|
* Sets the template filenames for handles.
|
||||||
*
|
*
|
||||||
|
@ -298,15 +253,15 @@ class phpbb_template
|
||||||
* configuration setting may be used to force templates to be always
|
* configuration setting may be used to force templates to be always
|
||||||
* recompiled.
|
* recompiled.
|
||||||
*
|
*
|
||||||
* Returns an object implementing phpbb_template_renderer, or null
|
* Returns an object implementing phpbb_style_template_renderer, or null
|
||||||
* if template loading or compilation failed. Call render() on the
|
* if template loading or compilation failed. Call render() on the
|
||||||
* renderer to display the template. This will result in template
|
* renderer to display the template. This will result in template
|
||||||
* contents sent to the output stream (unless, of course, output
|
* contents sent to the output stream (unless, of course, output
|
||||||
* buffering is in effect).
|
* buffering is in effect).
|
||||||
*
|
*
|
||||||
* @param string $handle Handle of the template to load
|
* @param string $handle Handle of the template to load
|
||||||
* @return phpbb_template_renderer Template renderer object, or null on failure
|
* @return phpbb_style_template_renderer Template renderer object, or null on failure
|
||||||
* @uses phpbb_template_compile is used to compile template source
|
* @uses phpbb_style_template_compile is used to compile template source
|
||||||
*/
|
*/
|
||||||
private function _tpl_load($handle)
|
private function _tpl_load($handle)
|
||||||
{
|
{
|
||||||
|
@ -330,18 +285,18 @@ class phpbb_template
|
||||||
// Recompile page if the original template is newer, otherwise load the compiled version
|
// Recompile page if the original template is newer, otherwise load the compiled version
|
||||||
if (!$recompile)
|
if (!$recompile)
|
||||||
{
|
{
|
||||||
return new phpbb_template_renderer_include($output_file, $this);
|
return new phpbb_style_template_renderer_include($output_file, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$compile = new phpbb_template_compile($this->config['tpl_allow_php']);
|
$compile = new phpbb_style_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path);
|
||||||
|
|
||||||
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
if ($compile->compile_file_to_file($source_file, $output_file) !== false)
|
||||||
{
|
{
|
||||||
$renderer = new phpbb_template_renderer_include($output_file, $this);
|
$renderer = new phpbb_style_template_renderer_include($output_file, $this);
|
||||||
}
|
}
|
||||||
else if (($code = $compile->compile_file($source_file)) !== false)
|
else if (($code = $compile->compile_file($source_file)) !== false)
|
||||||
{
|
{
|
||||||
$renderer = new phpbb_template_renderer_eval($code, $this);
|
$renderer = new phpbb_style_template_renderer_eval($code, $this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -403,7 +358,7 @@ class phpbb_template
|
||||||
$this->context->append_var($varname, $varval);
|
$this->context->append_var($varname, $varval);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Docstring is copied from phpbb_template_context method with the same name.
|
// Docstring is copied from phpbb_style_template_context method with the same name.
|
||||||
/**
|
/**
|
||||||
* Assign key variable pairs from an array to a specified block
|
* Assign key variable pairs from an array to a specified block
|
||||||
* @param string $blockname Name of block to assign $vararray to
|
* @param string $blockname Name of block to assign $vararray to
|
||||||
|
@ -414,7 +369,7 @@ class phpbb_template
|
||||||
return $this->context->assign_block_vars($blockname, $vararray);
|
return $this->context->assign_block_vars($blockname, $vararray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Docstring is copied from phpbb_template_context method with the same name.
|
// Docstring is copied from phpbb_style_template_context method with the same name.
|
||||||
/**
|
/**
|
||||||
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
* Change already assigned key variable pair (one-dimensional - single loop entry)
|
||||||
*
|
*
|
||||||
|
@ -501,4 +456,59 @@ class phpbb_template
|
||||||
}
|
}
|
||||||
include($file);
|
include($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locates source template path, accounting for styles tree and verifying that
|
||||||
|
* the path exists.
|
||||||
|
*
|
||||||
|
* @param string or array $files List of templates to locate. If there is only
|
||||||
|
* one template, $files can be a string to make code easier to read.
|
||||||
|
* @param bool $return_default Determines what to return if template does not
|
||||||
|
* exist. If true, function will return location where template is
|
||||||
|
* supposed to be. If false, function will return false.
|
||||||
|
* @param bool $return_full_path If true, function will return full path
|
||||||
|
* to template. If false, function will return template file name.
|
||||||
|
* This parameter can be used to check which one of set of template
|
||||||
|
* files is available.
|
||||||
|
* @return string or boolean Source template path if template exists or $return_default is
|
||||||
|
* true. False if template does not exist and $return_default is false
|
||||||
|
*/
|
||||||
|
public function locate($files, $return_default = false, $return_full_path = true)
|
||||||
|
{
|
||||||
|
// add tempalte path prefix
|
||||||
|
$templates = array();
|
||||||
|
if (is_string($files))
|
||||||
|
{
|
||||||
|
$templates[] = $this->template_path . $files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
$templates[] = $this->template_path . $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// use resource locator to find files
|
||||||
|
return $this->locator->get_first_file_location($templates, $return_default, $return_full_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include JS file
|
||||||
|
*
|
||||||
|
* @param string $file file name
|
||||||
|
* @param bool $locate True if file needs to be located
|
||||||
|
*/
|
||||||
|
public function _js_include($file, $locate = false)
|
||||||
|
{
|
||||||
|
// Locate file
|
||||||
|
if ($locate)
|
||||||
|
{
|
||||||
|
$file = $this->locator->get_first_file_location(array($file), true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add HTML code
|
||||||
|
$code = '<script src="' . htmlspecialchars($file) . '"></script>';
|
||||||
|
$this->context->append_var('SCRIPTS', $code);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@ if (!defined('IN_PHPBB'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_filter_register('phpbb_template', 'phpbb_template_filter');
|
stream_filter_register('phpbb_template', 'phpbb_style_template_filter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of template class - Functions needed for compiling templates only.
|
* Extension of template class - Functions needed for compiling templates only.
|
||||||
|
@ -23,23 +23,29 @@ stream_filter_register('phpbb_template', 'phpbb_template_filter');
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
||||||
*/
|
*/
|
||||||
class phpbb_template_compile
|
class phpbb_style_template_compile
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Whether <!-- PHP --> tags are allowed
|
* Array of parameters to forward to template filter
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $allow_php;
|
private $filter_params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
|
* @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
|
||||||
|
* @param phpbb_style_resource_locator $locator Resource locator
|
||||||
|
* @param string $phpbb_root_path Path to phpBB root directory
|
||||||
*/
|
*/
|
||||||
public function __construct($allow_php)
|
public function __construct($allow_php, $locator, $phpbb_root_path)
|
||||||
{
|
{
|
||||||
$this->allow_php = $allow_php;
|
$this->filter_params = array(
|
||||||
|
'allow_php' => $allow_php,
|
||||||
|
'locator' => $locator,
|
||||||
|
'phpbb_root_path' => $phpbb_root_path
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +122,7 @@ class phpbb_template_compile
|
||||||
*/
|
*/
|
||||||
private function compile_stream_to_stream($source_stream, $dest_stream)
|
private function compile_stream_to_stream($source_stream, $dest_stream)
|
||||||
{
|
{
|
||||||
stream_filter_append($source_stream, 'phpbb_template', null, array('allow_php' => $this->allow_php));
|
stream_filter_append($source_stream, 'phpbb_template', null, $this->filter_params);
|
||||||
stream_copy_to_stream($source_stream, $dest_stream);
|
stream_copy_to_stream($source_stream, $dest_stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_template_context
|
class phpbb_style_template_context
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* variable that holds all the data we'll be substituting into
|
* variable that holds all the data we'll be substituting into
|
||||||
|
@ -86,7 +86,7 @@ class phpbb_template_context
|
||||||
* Returns a reference to template data array.
|
* Returns a reference to template data array.
|
||||||
*
|
*
|
||||||
* This function is public so that template renderer may invoke it.
|
* This function is public so that template renderer may invoke it.
|
||||||
* Users should alter template variables via functions in phpbb_template.
|
* Users should alter template variables via functions in phpbb_style_template.
|
||||||
*
|
*
|
||||||
* Note: modifying returned array will affect data stored in the context.
|
* Note: modifying returned array will affect data stored in the context.
|
||||||
*
|
*
|
|
@ -35,7 +35,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* @see template_compile
|
* @see template_compile
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_template_filter extends php_user_filter
|
class phpbb_style_template_filter extends php_user_filter
|
||||||
{
|
{
|
||||||
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
||||||
|
|
||||||
|
@ -75,6 +75,18 @@ class phpbb_template_filter extends php_user_filter
|
||||||
*/
|
*/
|
||||||
private $allow_php;
|
private $allow_php;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resource locator.
|
||||||
|
*
|
||||||
|
* @var phpbb_template_locator
|
||||||
|
*/
|
||||||
|
private $locator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string phpBB root path
|
||||||
|
*/
|
||||||
|
private $phpbb_root_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream filter
|
* Stream filter
|
||||||
*
|
*
|
||||||
|
@ -126,14 +138,16 @@ class phpbb_template_filter extends php_user_filter
|
||||||
/**
|
/**
|
||||||
* Initializer, called on creation.
|
* Initializer, called on creation.
|
||||||
*
|
*
|
||||||
* Get the allow_php option from params, which is passed
|
* Get the allow_php option, root directory and locator from params,
|
||||||
* to stream_filter_append.
|
* which are passed to stream_filter_append.
|
||||||
*/
|
*/
|
||||||
public function onCreate()
|
public function onCreate()
|
||||||
{
|
{
|
||||||
$this->chunk = '';
|
$this->chunk = '';
|
||||||
$this->in_php = false;
|
$this->in_php = false;
|
||||||
$this->allow_php = $this->params['allow_php'];
|
$this->allow_php = $this->params['allow_php'];
|
||||||
|
$this->locator = $this->params['locator'];
|
||||||
|
$this->phpbb_root_path = $this->params['phpbb_root_path'];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,6 +295,10 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return ($this->allow_php) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
|
return ($this->allow_php) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'INCLUDEJS':
|
||||||
|
return '<?php ' . $this->compile_tag_include_js($matches[2]) . ' ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'PHP':
|
case 'PHP':
|
||||||
if ($this->allow_php)
|
if ($this->allow_php)
|
||||||
{
|
{
|
||||||
|
@ -856,6 +874,45 @@ class phpbb_template_filter extends php_user_filter
|
||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile INCLUDEJS tag
|
||||||
|
*
|
||||||
|
* @param string $tag_args Expression given with INCLUDEJS in source template
|
||||||
|
* @return string compiled template code
|
||||||
|
*/
|
||||||
|
private function compile_tag_include_js($tag_args)
|
||||||
|
{
|
||||||
|
// Process dynamic includes
|
||||||
|
if ($tag_args[0] == '{')
|
||||||
|
{
|
||||||
|
$var = $this->get_varref($tag_args, $is_expr);
|
||||||
|
if (!$is_expr)
|
||||||
|
{
|
||||||
|
return " \$_template->_js_include($var, true);";
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Locate file
|
||||||
|
$filename = $this->locator->get_first_file_location(array($tag_args), false, true);
|
||||||
|
|
||||||
|
if ($filename === false)
|
||||||
|
{
|
||||||
|
// File does not exist, find it during run time
|
||||||
|
return ' $_template->_js_include(\'' . addslashes($tag_args) . '\', true); ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path)
|
||||||
|
{
|
||||||
|
// Absolute path, include as is
|
||||||
|
return ' $_template->_js_include(\'' . addslashes($filename) . '\', false); ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relative path, remove root path from it
|
||||||
|
$filename = substr($filename, strlen($this->phpbb_root_path));
|
||||||
|
return ' global $phpbb_root_path; $_template->_js_include($phpbb_root_path . \'' . addslashes($filename) . '\', false); ';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a reference to the given variable inside the given (possibly nested)
|
* Generates a reference to the given variable inside the given (possibly nested)
|
||||||
* block namespace. This is a string of the form:
|
* block namespace. This is a string of the form:
|
|
@ -23,12 +23,12 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
interface phpbb_template_renderer
|
interface phpbb_style_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Displays the template managed by this renderer.
|
* Displays the template managed by this renderer.
|
||||||
*
|
*
|
||||||
* @param phpbb_template_context $context Template context to use
|
* @param phpbb_style_template_context $context Template context to use
|
||||||
* @param array $lang Language entries to use
|
* @param array $lang Language entries to use
|
||||||
*/
|
*/
|
||||||
public function render($context, $lang);
|
public function render($context, $lang);
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_template_renderer_eval implements phpbb_template_renderer
|
class phpbb_style_template_renderer_eval implements phpbb_style_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Template code to be eval'ed.
|
* Template code to be eval'ed.
|
||||||
|
@ -33,7 +33,7 @@ class phpbb_template_renderer_eval implements phpbb_template_renderer
|
||||||
* Template includes are delegated to template object $template.
|
* Template includes are delegated to template object $template.
|
||||||
*
|
*
|
||||||
* @param string $code php code of the template
|
* @param string $code php code of the template
|
||||||
* @param phpbb_template $template template object
|
* @param phpbb_style_template $template template object
|
||||||
*/
|
*/
|
||||||
public function __construct($code, $template)
|
public function __construct($code, $template)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ class phpbb_template_renderer_eval implements phpbb_template_renderer
|
||||||
* Displays the template managed by this renderer by eval'ing php code
|
* Displays the template managed by this renderer by eval'ing php code
|
||||||
* of the template.
|
* of the template.
|
||||||
*
|
*
|
||||||
* @param phpbb_template_context $context Template context to use
|
* @param phpbb_style_template_context $context Template context to use
|
||||||
* @param array $lang Language entries to use
|
* @param array $lang Language entries to use
|
||||||
*/
|
*/
|
||||||
public function render($context, $lang)
|
public function render($context, $lang)
|
|
@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_template_renderer_include implements phpbb_template_renderer
|
class phpbb_style_template_renderer_include implements phpbb_style_template_renderer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Template path to be included.
|
* Template path to be included.
|
||||||
|
@ -45,7 +45,7 @@ class phpbb_template_renderer_include implements phpbb_template_renderer
|
||||||
* Displays the template managed by this renderer by including
|
* Displays the template managed by this renderer by including
|
||||||
* the php file containing the template.
|
* the php file containing the template.
|
||||||
*
|
*
|
||||||
* @param phpbb_template_context $context Template context to use
|
* @param phpbb_style_template_context $context Template context to use
|
||||||
* @param array $lang Language entries to use
|
* @param array $lang Language entries to use
|
||||||
*/
|
*/
|
||||||
public function render($context, $lang)
|
public function render($context, $lang)
|
|
@ -1,130 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @copyright (c) 2011 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a template locator with core template paths and extension template paths
|
|
||||||
*
|
|
||||||
* Finds installed template paths and makes them available to the locator.
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class phpbb_template_extension_path_provider extends phpbb_extension_provider implements phpbb_template_path_provider_interface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Optional prefix for template paths searched within extensions.
|
|
||||||
*
|
|
||||||
* Empty by default. Relative to the extension directory. As an example, it
|
|
||||||
* could be adm/ for admin templates.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $ext_dir_prefix = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A provider of paths to be searched for templates
|
|
||||||
* @var phpbb_template_path_provider
|
|
||||||
*/
|
|
||||||
protected $base_path_provider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor stores extension manager
|
|
||||||
*
|
|
||||||
* @param phpbb_extension_manager $extension_manager phpBB extension manager
|
|
||||||
* @param phpbb_template_path_provider $base_path_provider A simple path provider
|
|
||||||
* to provide paths to be located in extensions
|
|
||||||
*/
|
|
||||||
public function __construct(phpbb_extension_manager $extension_manager, phpbb_template_path_provider $base_path_provider)
|
|
||||||
{
|
|
||||||
parent::__construct($extension_manager);
|
|
||||||
$this->base_path_provider = $base_path_provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a prefix for template paths searched within extensions.
|
|
||||||
*
|
|
||||||
* The prefix is inserted between the extension's path e.g. ext/foo/ and
|
|
||||||
* the looked up template path, e.g. styles/bar/template/some.html. So it
|
|
||||||
* should not have a leading slash, but should have a trailing slash.
|
|
||||||
*
|
|
||||||
* @param string $ext_dir_prefix The prefix including trailing slash
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_ext_dir_prefix($ext_dir_prefix)
|
|
||||||
{
|
|
||||||
$this->ext_dir_prefix = $ext_dir_prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds template paths using the extension manager
|
|
||||||
*
|
|
||||||
* Locates a path (e.g. styles/prosilver/template/) in all active extensions.
|
|
||||||
* Then appends the core template paths based in the current working
|
|
||||||
* directory.
|
|
||||||
*
|
|
||||||
* @return array List of template paths
|
|
||||||
*/
|
|
||||||
public function find()
|
|
||||||
{
|
|
||||||
$directories = array();
|
|
||||||
|
|
||||||
$finder = $this->extension_manager->get_finder();
|
|
||||||
foreach ($this->base_path_provider as $path)
|
|
||||||
{
|
|
||||||
if ($path && !phpbb_is_absolute($path))
|
|
||||||
{
|
|
||||||
$directories = array_merge($directories, $finder
|
|
||||||
->directory('/' . $this->ext_dir_prefix . $path)
|
|
||||||
->get_directories()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->base_path_provider as $path)
|
|
||||||
{
|
|
||||||
$directories[] = $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $directories;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overwrites the current template names and paths
|
|
||||||
*
|
|
||||||
* @param array $templates An associative map from template names to paths.
|
|
||||||
* The first element is the main template.
|
|
||||||
* If the path is false, it will be generated from
|
|
||||||
* the supplied name.
|
|
||||||
* @param string $style_root_path The root directory for styles identified
|
|
||||||
* by name only.
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_templates(array $templates, $style_root_path)
|
|
||||||
{
|
|
||||||
$this->base_path_provider->set_templates($templates, $style_root_path);
|
|
||||||
$this->items = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the path to the main template passed into set_templates()
|
|
||||||
*
|
|
||||||
* @return string Main template path
|
|
||||||
*/
|
|
||||||
public function get_main_template_path()
|
|
||||||
{
|
|
||||||
return $this->base_path_provider->get_main_template_path();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,214 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @copyright (c) 2011 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Paths to directories that templates are stored in.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $roots = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Index of the main template in the roots array
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $main_root_id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map from root index to 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.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $files = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Map from handles to source template file names.
|
|
||||||
* Covers the same data as $files property but maps to basenames
|
|
||||||
* instead of paths.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $filenames = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set main template location (must have been added through set_paths first).
|
|
||||||
*
|
|
||||||
* @param string $template_path Path to template directory
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_main_template($template)
|
|
||||||
{
|
|
||||||
$this->main_root_id = array_search($template, $this->roots, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the list of template paths
|
|
||||||
*
|
|
||||||
* These paths will be searched for template files in the provided order.
|
|
||||||
* Paths may be outside of phpBB, but templates loaded from these paths
|
|
||||||
* will still be cached.
|
|
||||||
*
|
|
||||||
* @param array $template_paths An array of paths to template directories
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_paths($template_paths)
|
|
||||||
{
|
|
||||||
$this->roots = array();
|
|
||||||
$this->files = array();
|
|
||||||
$this->filenames = array();
|
|
||||||
$this->main_root_id = 0;
|
|
||||||
|
|
||||||
foreach ($template_paths as $path)
|
|
||||||
{
|
|
||||||
// Make sure $path has no ending slash
|
|
||||||
if (substr($path, -1) === '/')
|
|
||||||
{
|
|
||||||
$path = substr($path, 0, -1);
|
|
||||||
}
|
|
||||||
$this->roots[] = $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;
|
|
||||||
|
|
||||||
foreach ($this->roots as $root_index => $root)
|
|
||||||
{
|
|
||||||
$this->files[$root_index][$handle] = $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[$this->main_root_id][$handle]))
|
|
||||||
{
|
|
||||||
trigger_error("template locator: No file specified for handle $handle", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$source_file = $this->files[$this->main_root_id][$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[$this->main_root_id][$handle]))
|
|
||||||
{
|
|
||||||
trigger_error("template locator: No file specified for handle $handle", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// locate a source file that exists
|
|
||||||
$source_file = $this->files[0][$handle];
|
|
||||||
$tried = $source_file;
|
|
||||||
for ($i = 1, $n = count($this->roots); $i < $n && !file_exists($source_file); $i++)
|
|
||||||
{
|
|
||||||
$source_file = $this->files[$i][$handle];
|
|
||||||
$tried .= ', ' . $source_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// search failed
|
|
||||||
if (!file_exists($source_file))
|
|
||||||
{
|
|
||||||
trigger_error("template locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $source_file;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @copyright (c) 2011 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a template locator with paths
|
|
||||||
*
|
|
||||||
* Finds installed template paths and makes them available to the locator.
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
class phpbb_template_path_provider implements IteratorAggregate, phpbb_template_path_provider_interface
|
|
||||||
{
|
|
||||||
protected $main_template_name = '';
|
|
||||||
protected $paths = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ignores the extension dir prefix
|
|
||||||
*
|
|
||||||
* @param string $ext_dir_prefix The prefix including trailing slash
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_ext_dir_prefix($ext_dir_prefix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overwrites the current template names and paths
|
|
||||||
*
|
|
||||||
* The first element of the passed templates map, is considered the main
|
|
||||||
* template and can be retrieved through get_main_template_path().
|
|
||||||
*
|
|
||||||
* @param array $templates An associative map from template names to paths.
|
|
||||||
* The first element is the main template.
|
|
||||||
* If the path is false, it will be generated from
|
|
||||||
* the supplied name.
|
|
||||||
* @param string $style_root_path The root directory for styles identified
|
|
||||||
* by name only.
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_templates(array $templates, $style_root_path)
|
|
||||||
{
|
|
||||||
$this->paths = array();
|
|
||||||
|
|
||||||
foreach ($templates as $name => $path)
|
|
||||||
{
|
|
||||||
if (!$path)
|
|
||||||
{
|
|
||||||
$path = $style_root_path . $this->template_root_for_style($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->paths[] = $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->main_template_path = $this->paths[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the path to the main template passed into set_templates()
|
|
||||||
*
|
|
||||||
* @return string Main template path
|
|
||||||
*/
|
|
||||||
public function get_main_template_path()
|
|
||||||
{
|
|
||||||
return $this->main_template_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a style name to relative (to board root or extension) path to
|
|
||||||
* the style's template files.
|
|
||||||
*
|
|
||||||
* @param $style_name string Style name
|
|
||||||
* @return string Path to style template files
|
|
||||||
*/
|
|
||||||
private function template_root_for_style($style_name)
|
|
||||||
{
|
|
||||||
return 'styles/' . $style_name . '/template';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve an iterator over all template paths
|
|
||||||
*
|
|
||||||
* @return ArrayIterator An iterator for the array of template paths
|
|
||||||
*/
|
|
||||||
public function getIterator()
|
|
||||||
{
|
|
||||||
return new ArrayIterator($this->paths);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
* @copyright (c) 2011 phpBB Group
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a template locator with paths
|
|
||||||
*
|
|
||||||
* Finds installed template paths and makes them available to the locator.
|
|
||||||
*
|
|
||||||
* @package phpBB3
|
|
||||||
*/
|
|
||||||
interface phpbb_template_path_provider_interface extends Traversable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Defines a prefix to use for template paths in extensions
|
|
||||||
*
|
|
||||||
* @param string $ext_dir_prefix The prefix including trailing slash
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_ext_dir_prefix($ext_dir_prefix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overwrites the current template names and paths
|
|
||||||
*
|
|
||||||
* @param array $templates An associative map from template names to paths.
|
|
||||||
* The first element is the main template.
|
|
||||||
* If the path is false, it will be generated from
|
|
||||||
* the supplied name.
|
|
||||||
* @param string $style_root_path The root directory for styles identified
|
|
||||||
* by name only.
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
public function set_templates(array $templates, $style_root_path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the path to the main template passed into set_templates()
|
|
||||||
*
|
|
||||||
* @return string Main template path
|
|
||||||
*/
|
|
||||||
public function get_main_template_path();
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue